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

PHP phpbb_is_writable函数代码示例

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

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



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

示例1: file_open

 /**
  * Open file for logging
  *
  * @param string $file File to open
  */
 protected function file_open($file)
 {
     if (phpbb_is_writable(dirname($file))) {
         $this->file_handle = fopen($file, 'w');
     } else {
         throw new \RuntimeException('Unable to write to migrator log file');
     }
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:13,代码来源:log_wrapper_migrator_output_handler.php


示例2: login_func

function login_func($xmlrpc_params)
{
    global $auth, $user, $config, $db, $phpbb_root_path, $phpEx;
    $params = php_xmlrpc_decode($xmlrpc_params);
    $user->setup('ucp');
    $username = $params[0];
    $password = $params[1];
    $viewonline = isset($params[2]) ? !$params[2] : 1;
    set_var($username, $username, 'string', true);
    set_var($password, $password, 'string', true);
    header('Set-Cookie: mobiquo_a=0');
    header('Set-Cookie: mobiquo_b=0');
    header('Set-Cookie: mobiquo_c=0');
    $login_result = $auth->login($username, $password, true, $viewonline);
    $usergroup_id = array();
    if ($login_result['status'] == LOGIN_SUCCESS) {
        $auth->acl($user->data);
        //add tapatalk_users here,for push service
        if ($params[3] == '1' && push_table_exists()) {
            global $table_prefix;
            $sql = "SELECT * FROM " . $table_prefix . "tapatalk_users where userid = '" . $user->data['user_id'] . "'";
            $result = $db->sql_query($sql);
            $userInfo = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            $time = time();
            if (empty($userInfo)) {
                $sql_data[$table_prefix . "tapatalk_users"]['sql'] = array('userid' => $user->data['user_id'], 'announcement' => 1, 'pm' => 1, 'subscribe' => 1, 'quote' => 1, 'tag' => 1, 'newtopic' => 1, 'updated' => time());
                $sql = 'INSERT INTO ' . $table_prefix . "tapatalk_users" . ' ' . $db->sql_build_array('INSERT', $sql_data[$table_prefix . "tapatalk_users"]['sql']);
                $db->sql_query($sql);
            } else {
                $sql = "UPDATE " . $table_prefix . "tapatalk_users \n\t        \tSET updated= '" . time() . "' WHERE userid='" . $user->data['user_id'] . "'";
                $db->sql_query($sql);
            }
        }
        // Compatibility with mod NV who was here
        if (file_exists($phpbb_root_path . 'includes/mods/who_was_here.' . $phpEx)) {
            include_once $phpbb_root_path . 'includes/mods/who_was_here.' . $phpEx;
            if (class_exists('phpbb_mods_who_was_here') && method_exists('phpbb_mods_who_was_here', 'update_session')) {
                @phpbb_mods_who_was_here::update_session();
            }
        }
    } else {
        $error_msg = str_replace('%s', '', strip_tags($user->lang[$login_result['error_msg']]));
        return new xmlrpcresp(new xmlrpcval(array('result' => new xmlrpcval(false, 'boolean'), 'result_text' => new xmlrpcval($error_msg, 'base64')), 'struct'));
    }
    if ($config['max_attachments'] == 0) {
        $config['max_attachments'] = 100;
    }
    $usergroup_id[] = new xmlrpcval($user->data['group_id']);
    $can_readpm = $config['allow_privmsg'] && $auth->acl_get('u_readpm') && ($user->data['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'));
    $can_sendpm = $config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user->data['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'));
    $can_upload = $config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && (function_exists('phpbb_is_writable') ? phpbb_is_writable($phpbb_root_path . $config['avatar_path']) : 1) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false;
    $can_search = $auth->acl_get('u_search') && $auth->acl_getf_global('f_search') && $config['load_search'];
    $can_whosonline = $auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel');
    $max_filesize = $config['max_filesize'] === '0' || $config['max_filesize'] > 10485760 ? 10485760 : $config['max_filesize'];
    $response = new xmlrpcval(array('result' => new xmlrpcval(true, 'boolean'), 'user_id' => new xmlrpcval($user->data['user_id'], 'string'), 'username' => new xmlrpcval($user->data['username'], 'base64'), 'usergroup_id' => new xmlrpcval($usergroup_id, 'array'), 'icon_url' => new xmlrpcval(get_user_avatar_url($user->data['user_avatar'], $user->data['user_avatar_type']), 'string'), 'post_count' => new xmlrpcval($user->data['user_posts'], 'int'), 'can_pm' => new xmlrpcval($can_readpm, 'boolean'), 'can_send_pm' => new xmlrpcval($can_sendpm, 'boolean'), 'can_moderate' => new xmlrpcval($auth->acl_get('m_') || $auth->acl_getf_global('m_'), 'boolean'), 'max_attachment' => new xmlrpcval($config['max_attachments'], 'int'), 'max_png_size' => new xmlrpcval($max_filesize, 'int'), 'max_jpg_size' => new xmlrpcval($max_filesize, 'int'), 'can_search' => new xmlrpcval($can_search, 'boolean'), 'can_whosonline' => new xmlrpcval($can_whosonline, 'boolean'), 'can_upload_avatar' => new xmlrpcval($can_upload, 'boolean')), 'struct');
    return new xmlrpcresp($response);
}
开发者ID:autonomous1,项目名称:tapatalk-phpbb3,代码行数:58,代码来源:login.php


示例3: save

 /**
  * {@inheritDoc}
  */
 function save()
 {
     if (!$this->is_modified) {
         return;
     }
     global $phpEx;
     if (!$this->_write('data_global')) {
         if (!function_exists('phpbb_is_writable')) {
             global $phpbb_root_path;
             include $phpbb_root_path . 'includes/functions.' . $phpEx;
         }
         // Now, this occurred how often? ... phew, just tell the user then...
         if (!phpbb_is_writable($this->cache_dir)) {
             // We need to use die() here, because else we may encounter an infinite loop (the message handler calls $cache->unload())
             die('Fatal: ' . $this->cache_dir . ' is NOT writable.');
             exit;
         }
         die('Fatal: Not able to open ' . $this->cache_dir . 'data_global.' . $phpEx);
         exit;
     }
     $this->is_modified = false;
 }
开发者ID:mike-a-b,项目名称:crossfit,代码行数:25,代码来源:file.php


示例4: can_upload

 /**
  * Check if user is able to upload an avatar
  *
  * @return bool True if user can upload, false if not
  */
 protected function can_upload()
 {
     return file_exists($this->phpbb_root_path . $this->config['avatar_path']) && phpbb_is_writable($this->phpbb_root_path . $this->config['avatar_path']) && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on');
 }
开发者ID:corycubbage,项目名称:ShadoWorld,代码行数:9,代码来源:upload.php


示例5: avatar_process_user

/**
* Uploading/Changing user avatar
*/
function avatar_process_user(&$error, $custom_userdata = false, $can_upload = null)
{
    global $config, $phpbb_root_path, $auth, $user, $db;
    $data = array('uploadurl' => request_var('uploadurl', ''), 'remotelink' => request_var('remotelink', ''), 'width' => request_var('width', 0), 'height' => request_var('height', 0));
    $error = validate_data($data, array('uploadurl' => array('string', true, 5, 255), 'remotelink' => array('string', true, 5, 255), 'width' => array('string', true, 1, 3), 'height' => array('string', true, 1, 3)));
    if (sizeof($error)) {
        return false;
    }
    $sql_ary = array();
    if ($custom_userdata === false) {
        $userdata =& $user->data;
    } else {
        $userdata =& $custom_userdata;
    }
    $data['user_id'] = $userdata['user_id'];
    $change_avatar = $custom_userdata === false ? $auth->acl_get('u_chgavatar') : true;
    $avatar_select = basename(request_var('avatar_select', ''));
    // Can we upload?
    if (is_null($can_upload)) {
        $can_upload = $config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $change_avatar && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false;
    }
    if ((!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload) {
        list($sql_ary['user_avatar_type'], $sql_ary['user_avatar'], $sql_ary['user_avatar_width'], $sql_ary['user_avatar_height']) = avatar_upload($data, $error);
    } else {
        if ($data['remotelink'] && $change_avatar && $config['allow_avatar_remote']) {
            list($sql_ary['user_avatar_type'], $sql_ary['user_avatar'], $sql_ary['user_avatar_width'], $sql_ary['user_avatar_height']) = avatar_remote($data, $error);
        } else {
            if ($avatar_select && $change_avatar && $config['allow_avatar_local']) {
                $category = basename(request_var('category', ''));
                $sql_ary['user_avatar_type'] = AVATAR_GALLERY;
                $sql_ary['user_avatar'] = $avatar_select;
                // check avatar gallery
                if (!is_dir($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category)) {
                    $sql_ary['user_avatar'] = '';
                    $sql_ary['user_avatar_type'] = $sql_ary['user_avatar_width'] = $sql_ary['user_avatar_height'] = 0;
                } else {
                    list($sql_ary['user_avatar_width'], $sql_ary['user_avatar_height']) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . urldecode($sql_ary['user_avatar']));
                    $sql_ary['user_avatar'] = $category . '/' . $sql_ary['user_avatar'];
                }
            } else {
                if (isset($_POST['delete']) && $change_avatar) {
                    $sql_ary['user_avatar'] = '';
                    $sql_ary['user_avatar_type'] = $sql_ary['user_avatar_width'] = $sql_ary['user_avatar_height'] = 0;
                } else {
                    if (!empty($userdata['user_avatar'])) {
                        // Only update the dimensions
                        if (empty($data['width']) || empty($data['height'])) {
                            if ($dims = avatar_get_dimensions($userdata['user_avatar'], $userdata['user_avatar_type'], $error, $data['width'], $data['height'])) {
                                list($guessed_x, $guessed_y) = $dims;
                                if (empty($data['width'])) {
                                    $data['width'] = $guessed_x;
                                }
                                if (empty($data['height'])) {
                                    $data['height'] = $guessed_y;
                                }
                            }
                        }
                        if (($config['avatar_max_width'] || $config['avatar_max_height']) && ($data['width'] != $userdata['user_avatar_width'] || $data['height'] != $userdata['user_avatar_height'])) {
                            if ($data['width'] > $config['avatar_max_width'] || $data['height'] > $config['avatar_max_height']) {
                                $error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']);
                            }
                        }
                        if (!sizeof($error)) {
                            if ($config['avatar_min_width'] || $config['avatar_min_height']) {
                                if ($data['width'] < $config['avatar_min_width'] || $data['height'] < $config['avatar_min_height']) {
                                    $error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']);
                                }
                            }
                        }
                        if (!sizeof($error)) {
                            $sql_ary['user_avatar_width'] = $data['width'];
                            $sql_ary['user_avatar_height'] = $data['height'];
                        }
                    }
                }
            }
        }
    }
    if (!sizeof($error)) {
        // Do we actually have any data to update?
        if (sizeof($sql_ary)) {
            $ext_new = $ext_old = '';
            if (isset($sql_ary['user_avatar'])) {
                $userdata = $custom_userdata === false ? $user->data : $custom_userdata;
                $ext_new = empty($sql_ary['user_avatar']) ? '' : substr(strrchr($sql_ary['user_avatar'], '.'), 1);
                $ext_old = empty($userdata['user_avatar']) ? '' : substr(strrchr($userdata['user_avatar'], '.'), 1);
                if ($userdata['user_avatar_type'] == AVATAR_UPLOAD) {
                    // Delete old avatar if present
                    if (!empty($userdata['user_avatar']) && empty($sql_ary['user_avatar']) || !empty($userdata['user_avatar']) && !empty($sql_ary['user_avatar']) && $ext_new !== $ext_old) {
                        avatar_delete('user', $userdata);
                    }
                }
            }
            $sql = 'UPDATE ' . USERS_TABLE . '
				SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
				WHERE user_id = ' . ($custom_userdata === false ? $user->data['user_id'] : $custom_userdata['user_id']);
            $db->sql_query($sql);
//.........这里部分代码省略.........
开发者ID:eyumay,项目名称:ju.ejhs,代码行数:101,代码来源:functions_user.php


示例6: banner_process

 /**
  * Primary work on banner, can edit, copy or check a banner
  *
  * @param	string	$banner	The banner's remote url
  * @param	array	$error	The array error, passed by reference
  * @return	null
  */
 public function banner_process(&$banner, &$error)
 {
     $old_banner = $this->request->variable('old_banner', '');
     $destination = $this->dir_helper->get_banner_path();
     // Can we upload?
     $can_upload = $this->config['dir_storage_banner'] && file_exists($this->root_path . $destination) && phpbb_is_writable($this->root_path . $destination) && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false;
     if ($banner && $can_upload) {
         $file = $this->_banner_upload($banner, $error);
     } else {
         if ($banner) {
             $file = $this->_banner_remote($banner, $error);
         } else {
             if ($this->request->is_set_post('delete_banner') && $old_banner) {
                 $this->_banner_delete($old_banner);
                 return;
             }
         }
     }
     if (!sizeof($error)) {
         if ($banner && $old_banner && !preg_match('/^(http:\\/\\/|https:\\/\\/|ftp:\\/\\/|ftps:\\/\\/|www\\.).+/si', $old_banner)) {
             $this->_banner_delete($old_banner);
         }
         $banner = !empty($file) ? $file : '';
     }
 }
开发者ID:rmcgirr83,项目名称:ext-phpbb-directory,代码行数:32,代码来源:link.php


示例7: main


//.........这里部分代码省略.........
                    $group_row = $db->sql_fetchrow($result);
                    $db->sql_freeresult($result);
                    if (!$group_row) {
                        trigger_error($user->lang['NO_GROUP'] . $return_page);
                    }
                    // Check if the user is allowed to manage this group if set to founder only.
                    if ($user->data['user_type'] != USER_FOUNDER && $group_row['group_founder_manage']) {
                        trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . $return_page, E_USER_WARNING);
                    }
                    $group_name = $group_row['group_name'];
                    $group_type = $group_row['group_type'];
                    $avatar_img = !empty($group_row['group_avatar']) ? get_user_avatar($group_row['group_avatar'], $group_row['group_avatar_type'], $group_row['group_avatar_width'], $group_row['group_avatar_height'], 'GROUP_AVATAR') : '<img src="' . $phpbb_root_path . 'adm/images/no_avatar.gif" alt="" />';
                    $template->assign_vars(array('GROUP_NAME' => $group_type == GROUP_SPECIAL ? $user->lang['G_' . $group_name] : $group_name, 'GROUP_INTERNAL_NAME' => $group_name, 'GROUP_COLOUR' => isset($group_row['group_colour']) ? $group_row['group_colour'] : '', 'GROUP_DESC_DISP' => generate_text_for_display($group_row['group_desc'], $group_row['group_desc_uid'], $group_row['group_desc_bitfield'], $group_row['group_desc_options']), 'GROUP_TYPE' => $group_row['group_type'], 'AVATAR' => $avatar_img, 'AVATAR_IMAGE' => $avatar_img, 'AVATAR_WIDTH' => isset($group_row['group_avatar_width']) ? $group_row['group_avatar_width'] : '', 'AVATAR_HEIGHT' => isset($group_row['group_avatar_height']) ? $group_row['group_avatar_height'] : ''));
                }
                switch ($action) {
                    case 'edit':
                        if (!$group_id) {
                            trigger_error($user->lang['NO_GROUP'] . $return_page);
                        }
                        if (!($row = group_memberships($group_id, $user->data['user_id']))) {
                            trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
                        }
                        list(, $row) = each($row);
                        if (!$row['group_leader']) {
                            trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
                        }
                        $file_uploads = @ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on' ? true : false;
                        $user->add_lang(array('acp/groups', 'acp/common'));
                        $data = $submit_ary = array();
                        $update = isset($_POST['update']) ? true : false;
                        $error = array();
                        $avatar_select = basename(request_var('avatar_select', ''));
                        $category = basename(request_var('category', ''));
                        $can_upload = file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads ? true : false;
                        // Did we submit?
                        if ($update) {
                            $group_name = utf8_normalize_nfc(request_var('group_name', '', true));
                            $group_desc = utf8_normalize_nfc(request_var('group_desc', '', true));
                            $group_type = request_var('group_type', GROUP_FREE);
                            $allow_desc_bbcode = request_var('desc_parse_bbcode', false);
                            $allow_desc_urls = request_var('desc_parse_urls', false);
                            $allow_desc_smilies = request_var('desc_parse_smilies', false);
                            $submit_ary = array('colour' => request_var('group_colour', ''), 'rank' => request_var('group_rank', 0), 'receive_pm' => isset($_REQUEST['group_receive_pm']) ? 1 : 0, 'message_limit' => request_var('group_message_limit', 0), 'max_recipients' => request_var('group_max_recipients', 0));
                            $data['uploadurl'] = request_var('uploadurl', '');
                            $data['remotelink'] = request_var('remotelink', '');
                            $data['width'] = request_var('width', '');
                            $data['height'] = request_var('height', '');
                            $delete = request_var('delete', '');
                            if (!empty($_FILES['uploadfile']['tmp_name']) || $data['uploadurl'] || $data['remotelink']) {
                                // Avatar stuff
                                $var_ary = array('uploadurl' => array('string', true, 5, 255), 'remotelink' => array('string', true, 5, 255), 'width' => array('string', true, 1, 3), 'height' => array('string', true, 1, 3));
                                if (!($error = validate_data($data, $var_ary))) {
                                    $data['user_id'] = "g{$group_id}";
                                    if ((!empty($_FILES['uploadfile']['tmp_name']) || $data['uploadurl']) && $can_upload) {
                                        list($submit_ary['avatar_type'], $submit_ary['avatar'], $submit_ary['avatar_width'], $submit_ary['avatar_height']) = avatar_upload($data, $error);
                                    } else {
                                        if ($data['remotelink']) {
                                            list($submit_ary['avatar_type'], $submit_ary['avatar'], $submit_ary['avatar_width'], $submit_ary['avatar_height']) = avatar_remote($data, $error);
                                        }
                                    }
                                }
                            } else {
                                if ($avatar_select && $config['allow_avatar_local']) {
                                    // check avatar gallery
                                    if (is_dir($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category)) {
                                        $submit_ary['avatar_type'] = AVATAR_GALLERY;
开发者ID:eyumay,项目名称:ju.ejhs,代码行数:67,代码来源:ucp_groups.php


示例8: main


//.........这里部分代码省略.........
                     if ($test_connection === true) {
                         // Check for common.php file
                         if (!$transfer->file_exists($phpbb_root_path, 'common.' . $phpEx)) {
                             $test_connection = 'ERR_WRONG_PATH_TO_PHPBB';
                         }
                     }
                     $transfer->close_session();
                     // Make sure the login details are correct before continuing
                     if ($submit && $test_connection !== true) {
                         $submit = false;
                         $test_ftp_connection = true;
                     }
                 }
                 $s_hidden_fields .= build_hidden_fields(array('method' => $method));
                 if (!$submit) {
                     $this->page_title = 'SELECT_FTP_SETTINGS';
                     if (!class_exists($method)) {
                         trigger_error('Method does not exist.', E_USER_ERROR);
                     }
                     $requested_data = call_user_func(array($method, 'data'));
                     foreach ($requested_data as $data => $default) {
                         $template->assign_block_vars('data', array('DATA' => $data, 'NAME' => $user->lang[strtoupper($method . '_' . $data)], 'EXPLAIN' => $user->lang[strtoupper($method . '_' . $data) . '_EXPLAIN'], 'DEFAULT' => $request->variable($data, (string) $default)));
                     }
                     $template->assign_vars(array('S_CONNECTION_SUCCESS' => $test_ftp_connection && $test_connection === true ? true : false, 'S_CONNECTION_FAILED' => $test_ftp_connection && $test_connection !== true ? true : false, 'ERROR_MSG' => $test_ftp_connection && $test_connection !== true ? $user->lang[$test_connection] : '', 'S_FTP_UPLOAD' => true, 'UPLOAD_METHOD' => $method, 'U_ACTION' => append_sid($this->p_master->module_url, "language={$language}&amp;mode={$mode}&amp;sub=update_files"), 'U_DOWNLOAD_METHOD' => append_sid($this->p_master->module_url, "language={$language}&amp;mode={$mode}&amp;sub=update_files&amp;download=1"), 'S_HIDDEN_FIELDS' => $s_hidden_fields));
                     return;
                 }
                 $update_mode = 'upload';
             }
             // Now update the installation or download the archive...
             $download_filename = 'update_' . $this->update_info['version']['from'] . '_to_' . $this->update_info['version']['to'];
             $archive_filename = $download_filename . '_' . time() . '_' . unique_id();
             // Now init the connection
             if ($update_mode == 'download') {
                 if (function_exists('phpbb_is_writable') && !phpbb_is_writable($phpbb_root_path . 'store/')) {
                     trigger_error(sprintf('The directory “%s” is not writable.', $phpbb_root_path . 'store/'), E_USER_ERROR);
                 }
                 if ($use_method == '.zip') {
                     $compress = new compress_zip('w', $phpbb_root_path . 'store/' . $archive_filename . $use_method);
                 } else {
                     $compress = new compress_tar('w', $phpbb_root_path . 'store/' . $archive_filename . $use_method, $use_method);
                 }
             } else {
                 $transfer = new $method(request_var('host', ''), request_var('username', ''), htmlspecialchars_decode($request->untrimmed_variable('password', '')), request_var('root_path', ''), request_var('port', ''), request_var('timeout', ''));
                 $transfer->open_session();
             }
             // Ok, go through the update list and do the operations based on their status
             foreach ($update_list as $status => $files) {
                 if (!is_array($files)) {
                     continue;
                 }
                 foreach ($files as $file_struct) {
                     // Skip this file if the user selected to not update it
                     if (in_array($file_struct['filename'], $no_update)) {
                         continue;
                     }
                     $original_filename = $file_struct['custom'] ? $file_struct['original'] : $file_struct['filename'];
                     switch ($status) {
                         case 'new':
                         case 'new_conflict':
                         case 'not_modified':
                             if ($update_mode == 'download') {
                                 $compress->add_custom_file($this->new_location . $original_filename, $file_struct['filename']);
                             } else {
                                 if ($status != 'new') {
                                     $transfer->rename($file_struct['filename'], $file_struct['filename'] . '.bak');
                                 }
开发者ID:Voxel37,项目名称:phpbb,代码行数:67,代码来源:install_update.php


示例9: copy_dir

function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_failure = true, $source_relative_path = true)
{
    global $convert, $phpbb_root_path, $config, $user, $db;
    $dirlist = $filelist = $bad_dirs = array();
    $src = path($src, $source_relative_path);
    $trg = path($trg);
    $src_path = relative_base($src, $source_relative_path, __LINE__, __FILE__);
    $trg_path = $phpbb_root_path . $trg;
    if (!is_dir($trg_path)) {
        @mkdir($trg_path, 0777);
        @chmod($trg_path, 0777);
    }
    if (!phpbb_is_writable($trg_path)) {
        $bad_dirs[] = path($config['script_path']) . $trg;
    }
    if ($handle = @opendir($src_path)) {
        while ($entry = readdir($handle)) {
            if ($entry[0] == '.' || $entry == 'CVS' || $entry == 'index.htm') {
                continue;
            }
            if (is_dir($src_path . $entry)) {
                $dirlist[] = $entry;
            } else {
                $filelist[] = $entry;
            }
        }
        closedir($handle);
    } else {
        if ($dir = @dir($src_path)) {
            while ($entry = $dir->read()) {
                if ($entry[0] == '.' || $entry == 'CVS' || $entry == 'index.htm') {
                    continue;
                }
                if (is_dir($src_path . $entry)) {
                    $dirlist[] = $entry;
                } else {
                    $filelist[] = $entry;
                }
            }
            $dir->close();
        } else {
            $convert->p_master->error(sprintf($user->lang['CONV_ERROR_COULD_NOT_READ'], relative_base($src, $source_relative_path)), __LINE__, __FILE__);
        }
    }
    if ($copy_subdirs) {
        for ($i = 0; $i < sizeof($dirlist); ++$i) {
            $dir = $dirlist[$i];
            if ($dir == 'CVS') {
                continue;
            }
            if (!is_dir($trg_path . $dir)) {
                @mkdir($trg_path . $dir, 0777);
                @chmod($trg_path . $dir, 0777);
            }
            if (!phpbb_is_writable($trg_path . $dir)) {
                $bad_dirs[] = $trg . $dir;
                $bad_dirs[] = $trg_path . $dir;
            }
            if (!sizeof($bad_dirs)) {
                copy_dir($src . $dir, $trg . $dir, true, $overwrite, $die_on_failure, $source_relative_path);
            }
        }
    }
    if (sizeof($bad_dirs)) {
        $str = sizeof($bad_dirs) == 1 ? $user->lang['MAKE_FOLDER_WRITABLE'] : $user->lang['MAKE_FOLDERS_WRITABLE'];
        sort($bad_dirs);
        $convert->p_master->error(sprintf($str, implode('<br />', $bad_dirs)), __LINE__, __FILE__);
    }
    for ($i = 0; $i < sizeof($filelist); ++$i) {
        copy_file($src . $filelist[$i], $trg . $filelist[$i], $overwrite, $die_on_failure, $source_relative_path);
    }
}
开发者ID:abhinay100,项目名称:phpbb2_app,代码行数:72,代码来源:functions_convert.php


示例10: disable_avatars_if_unwritable

 /**
  * Check if the avatar directory is writable and disable avatars
  * if it isn't writable.
  */
 function disable_avatars_if_unwritable()
 {
     global $phpbb_root_path;
     if (!phpbb_is_writable($phpbb_root_path . 'images/avatars/upload/')) {
         set_config('allow_avatar', 0);
         set_config('allow_avatar_upload', 0);
     }
 }
开发者ID:PetsFundation,项目名称:Pets,代码行数:12,代码来源:install_install.php


示例11: main


//.........这里部分代码省略.........
                // Get additional profile fields and assign them to the template block var 'profile_fields'
                $user->get_profile_fields($user->data['user_id']);
                $cp->generate_profile_fields('profile', $user->get_iso_lang_id());
                break;
            case 'signature':
                if (!$auth->acl_get('u_sig')) {
                    trigger_error('NO_AUTH_SIGNATURE');
                }
                include $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
                include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
                $enable_bbcode = $config['allow_sig_bbcode'] ? (bool) $user->optionget('sig_bbcode') : false;
                $enable_smilies = $config['allow_sig_smilies'] ? (bool) $user->optionget('sig_smilies') : false;
                $enable_urls = $config['allow_sig_links'] ? (bool) $user->optionget('sig_links') : false;
                $signature = utf8_normalize_nfc(request_var('signature', (string) $user->data['user_sig'], true));
                add_form_key('ucp_sig');
                if ($submit || $preview) {
                    include $phpbb_root_path . 'includes/message_parser.' . $phpEx;
                    $enable_bbcode = $config['allow_sig_bbcode'] ? request_var('disable_bbcode', false) ? false : true : false;
                    $enable_smilies = $config['allow_sig_smilies'] ? request_var('disable_smilies', false) ? false : true : false;
                    $enable_urls = $config['allow_sig_links'] ? request_var('disable_magic_url', false) ? false : true : false;
                    if (!sizeof($error)) {
                        $message_parser = new parse_message($signature);
                        // Allowing Quote BBCode
                        $message_parser->parse($enable_bbcode, $enable_urls, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, $config['allow_sig_links'], true, 'sig');
                        if (sizeof($message_parser->warn_msg)) {
                            $error[] = implode('<br />', $message_parser->warn_msg);
                        }
                        if (!check_form_key('ucp_sig')) {
                            $error[] = 'FORM_INVALID';
                        }
                        if (!sizeof($error) && $submit) {
                            $user->optionset('sig_bbcode', $enable_bbcode);
                            $user->optionset('sig_smilies', $enable_smilies);
                            $user->optionset('sig_links', $enable_urls);
                            $sql_ary = array('user_sig' => (string) $message_parser->message, 'user_options' => $user->data['user_options'], 'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid, 'user_sig_bbcode_bitfield' => $message_parser->bbcode_bitfield);
                            $sql = 'UPDATE ' . USERS_TABLE . '
								SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
								WHERE user_id = ' . $user->data['user_id'];
                            $db->sql_query($sql);
                            $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
                            trigger_error($message);
                        }
                    }
                    // Replace "error" strings with their real, localised form
                    $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
                }
                $signature_preview = '';
                if ($preview) {
                    // Now parse it for displaying
                    $signature_preview = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false);
                    unset($message_parser);
                }
                decode_message($signature, $user->data['user_sig_bbcode_uid']);
                $template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'SIGNATURE' => $signature, 'SIGNATURE_PREVIEW' => $signature_preview, 'S_BBCODE_CHECKED' => !$enable_bbcode ? ' checked="checked"' : '', 'S_SMILIES_CHECKED' => !$enable_smilies ? ' checked="checked"' : '', 'S_MAGIC_URL_CHECKED' => !$enable_urls ? ' checked="checked"' : '', 'BBCODE_STATUS' => $config['allow_sig_bbcode'] ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.{$phpEx}", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.{$phpEx}", 'mode=bbcode') . '">', '</a>'), 'SMILIES_STATUS' => $config['allow_sig_smilies'] ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], 'IMG_STATUS' => $config['allow_sig_img'] ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $config['allow_sig_flash'] ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], 'URL_STATUS' => $config['allow_sig_links'] ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], 'MAX_FONT_SIZE' => (int) $config['max_sig_font_size'], 'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']), 'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'], 'S_SMILIES_ALLOWED' => $config['allow_sig_smilies'], 'S_BBCODE_IMG' => $config['allow_sig_img'] ? true : false, 'S_BBCODE_FLASH' => $config['allow_sig_flash'] ? true : false, 'S_LINKS_ALLOWED' => $config['allow_sig_links'] ? true : false));
                // Build custom bbcodes array
                display_custom_bbcodes();
                break;
            case 'avatar':
                include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
                $display_gallery = request_var('display_gallery', '0');
                $avatar_select = basename(request_var('avatar_select', ''));
                $category = basename(request_var('category', ''));
                $can_upload = file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false;
                add_form_key('ucp_avatar');
                if ($submit) {
                    if (check_form_key('ucp_avatar')) {
                        if (avatar_process_user($error, false, $can_upload)) {
                            meta_refresh(3, $this->u_action);
                            $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
                            trigger_error($message);
                        }
                    } else {
                        $error[] = 'FORM_INVALID';
                    }
                    // Replace "error" strings with their real, localised form
                    $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
                }
                if (!$config['allow_avatar'] && $user->data['user_avatar_type']) {
                    $error[] = $user->lang['AVATAR_NOT_ALLOWED'];
                } else {
                    if ($user->data['user_avatar_type'] == AVATAR_UPLOAD && !$config['allow_avatar_upload'] || $user->data['user_avatar_type'] == AVATAR_REMOTE && !$config['allow_avatar_remote'] || $user->data['user_avatar_type'] == AVATAR_GALLERY && !$config['allow_avatar_local']) {
                        $error[] = $user->lang['AVATAR_TYPE_NOT_ALLOWED'];
                    }
                }
                $template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'AVATAR' => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height'], 'USER_AVATAR', true), 'AVATAR_SIZE' => $config['avatar_filesize'], 'U_GALLERY' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=profile&amp;mode=avatar&amp;display_gallery=1'), 'S_FORM_ENCTYPE' => $can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload']) ? ' enctype="multipart/form-data"' : '', 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024)));
                if ($config['allow_avatar'] && $display_gallery && $auth->acl_get('u_chgavatar') && $config['allow_avatar_local']) {
                    avatar_gallery($category, $avatar_select, 4);
                } else {
                    if ($config['allow_avatar']) {
                        $avatars_enabled = $can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload']) || $auth->acl_get('u_chgavatar') && ($config['allow_avatar_local'] || $config['allow_avatar_remote']) ? true : false;
                        $template->assign_vars(array('AVATAR_WIDTH' => request_var('width', $user->data['user_avatar_width']), 'AVATAR_HEIGHT' => request_var('height', $user->data['user_avatar_height']), 'S_AVATARS_ENABLED' => $avatars_enabled, 'S_UPLOAD_AVATAR_FILE' => $can_upload && $config['allow_avatar_upload'] ? true : false, 'S_UPLOAD_AVATAR_URL' => $can_upload && $config['allow_avatar_remote_upload'] ? true : false, 'S_LINK_AVATAR' => $auth->acl_get('u_chgavatar') && $config['allow_avatar_remote'] ? true : false, 'S_DISPLAY_GALLERY' => $auth->acl_get('u_chgavatar') && $config['allow_avatar_local'] ? true : false));
                    }
                }
                break;
        }
        $template->assign_vars(array('L_TITLE' => $user->lang['UCP_PROFILE_' . strtoupper($mode)], 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_UCP_ACTION' => $this->u_action));
        // Set desired template
        $this->tpl_name = 'ucp_profile_' . $mode;
        $this->page_title = 'UCP_PROFILE_' . strtoupper($mode);
    }
开发者ID:ahmatjan,项目名称:Crimson,代码行数:101,代码来源:ucp_profile.php


示例12: _store_in_fs

    /**
     * Moves a template set to the filesystem
     *
     * @access private
     * @param string $mode The component to move - only template is supported
     * @param int $id The template id
     * @param string $path The path to the template
     */
    function _store_in_fs($mode, $id, $path)
    {
        global $phpbb_root_path, $db, $user, $safe_mode;
        $store_db = 0;
        $error = array();
        if (!$safe_mode && phpbb_is_writable("{$phpbb_root_path}styles/{$path}/template")) {
            $sql = 'SELECT *
					FROM ' . STYLES_TEMPLATE_DATA_TABLE . "\n\t\t\t\t\tWHERE template_id = {$id}";
            $result = $db->sql_query($sql);
            while ($row = $db->sql_fetchrow($result)) {
                if (!($fp = @fopen("{$phpbb_root_path}styles/{$path}/template/" . $row['template_filename'], 'wb'))) {
                    $store_db = 1;
                    $error[] = $user->lang['EDIT_TEMPLATE_STORED_DB'];
                    break;
                }
                fwrite($fp, $row['template_data']);
                fclose($fp);
            }
            $db->sql_freeresult($result);
            if (!$store_db) {
                $sql = 'DELETE FROM ' . STYLES_TEMPLATE_DATA_TABLE . "\n\t\t\t\t\t\tWHERE template_id = {$id}";
                $db->sql_query($sql);
            }
        }
        if (sizeof($error)) {
            return $error;
        }
        $sql = 'UPDATE ' . STYLES_TEMPLATE_TABLE . '
				SET template_storedb = 0
				WHERE template_id = ' . $id;
        $db->sql_query($sql);
        return false;
    }
开发者ID:ahmatjan,项目名称:Crimson,代码行数:41,代码来源:acp_styles.php


示例13: _is_writable

 public function _is_writable($file, $path = 'gallery', $sub_directory = 'includes/')
 {
     return phpbb_is_writable($this->path($path) . $sub_directory . $this->phpEx_file($file));
 }
开发者ID:here-we-go,项目名称:phpbbgallery,代码行数:4,代码来源:url.php


示例14: test_upload

 /**
  * Test Settings
  */
 function test_upload(&$error, $upload_dir, $create_directory = false)
 {
     global $user, $phpbb_root_path;
     // Does the target directory exist, is it a directory and writable.
     if ($create_directory) {
         if (!file_exists($phpbb_root_path . $upload_dir)) {
             @mkdir($phpbb_root_path . $upload_dir, 0777);
             phpbb_chmod($phpbb_root_path . $upload_dir, CHMOD_READ | CHMOD_WRITE);
         }
     }
     if (!file_exists($phpbb_root_path . $upload_dir)) {
         $error[] = sprintf($user->lang['NO_UPLOAD_DIR'], $upload_dir);
         return;
     }
     if (!is_dir($phpbb_root_path . $upload_dir)) {
         $error[] = sprintf($user->lang['UPLOAD_NOT_DIR'], $upload_dir);
         return;
     }
     if (!phpbb_is_writable($phpbb_root_path . $upload_dir)) {
         $error[] = sprintf($user->lang['NO_WRITE_UPLOAD'], $upload_dir);
         return;
     }
 }
开发者ID:eyumay,项目名称:ju.ejhs,代码行数:26,代码来源:acp_attachments.php


示例15: main


//.........这里部分代码省略.........
							$template->assign_block_vars('data', array(
								'DATA'		=> $data,
								'NAME'		=> $user->lang[strtoupper($method . '_' . $data)],
								'EXPLAIN'	=> $user->lang[strtoupper($method . '_' . $data) . '_EXPLAIN'],
								'DEFAULT'	=> (!empty($_REQUEST[$data])) ? request_var($data, '') : $default
							));
						}

						$template->assign_vars(array(
							'S_C 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP phpbb_ltrim函数代码示例发布时间:2022-05-15
下一篇:
PHP phpbb_ip_normalise函数代码示例发布时间: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