예제 #1
0
파일: select_avatar.php 프로젝트: rair/yacs
 *
 * Accept following invocations:
 * - users/select_avatar.php/12
 * - users/select_avatar.php?id=12
 *
 * @author Bernard Paques
 * @author GnapZ
 * @tester Kedare
 * @reference
 * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License
 */
// common definitions and initial processing
include_once '../shared/global.php';
include_once '../images/images.php';
// the maximum size for uploads
$image_maximum_size = str_replace('M', '000000', Safe::get_cfg_var('upload_max_filesize'));
if (!$image_maximum_size || $image_maximum_size > 20000000) {
    $image_maximum_size = 2000000;
}
// look for the id
$id = NULL;
if (isset($_REQUEST['id'])) {
    $id = $_REQUEST['id'];
} elseif (isset($context['arguments'][0])) {
    $id = $context['arguments'][0];
} elseif (Surfer::is_logged()) {
    $id = Surfer::get_id();
}
$id = strip_tags($id);
// get the item from the database
$item = Users::get($id);
예제 #2
0
파일: files.php 프로젝트: rair/yacs
                        }
                        // create the record in the database
                        if (!($fields['id'] = Files::post($fields))) {
                            return FALSE;
                        }
                        // record surfer activity
                        Activities::post('file:' . $fields['id'], 'upload');
                    }
                }
                // so far so good
                if (count($context['uploaded_files']) == 1) {
                    return $context['uploaded_files'][0];
                } else {
                    return $context['uploaded_files'];
                }
            }
        }
        // some error has occured
        return FALSE;
    }
}
// load localized strings
if (is_callable(array('i18n', 'bind'))) {
    i18n::bind('files');
}
// the maximum size for uploads
global $context;
$context['file_maximum_size'] = str_replace('M', ' M', Safe::get_cfg_var('upload_max_filesize'));
if (!$context['file_maximum_size']) {
    $context['file_maximum_size'] = '2 M';
}