本文整理汇总了PHP中object::M方法的典型用法代码示例。如果您正苦于以下问题:PHP object::M方法的具体用法?PHP object::M怎么用?PHP object::M使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类object
的用法示例。
在下文中一共展示了object::M方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: perform
/**
* Execute the view of the template "adduser.tpl.php"
*
* @return bool true on success else false
*/
function perform()
{
// check permission to add new user
$this->B->F(USER_FILTER, 'permission', array('action' => 'add'));
// add user on demande
if ($_GET['sec'] == 'adduser' && isset($_POST['adduser'])) {
// Init form field values
$this->B->tpl_error = FALSE;
$this->B->form_forename = '';
$this->B->form_lastname = '';
$this->B->form_email = '';
$this->B->form_login = '';
$this->B->form_passwd = '';
$this->B->form_rights = '';
$this->B->form_status = '';
// check if required fields are empty
if (FALSE == $this->_check_empty_fields()) {
$this->_reset_old_fields_data();
return TRUE;
}
$_data = array('error' => 'tpl_error', 'user_data' => array('forename' => $this->B->db->escape(commonUtil::stripSlashes($_POST['forename'])), 'lastname' => $this->B->db->escape(commonUtil::stripSlashes($_POST['lastname'])), 'email' => $this->B->db->escape(commonUtil::stripSlashes($_POST['email'])), 'login' => $this->B->db->escape(commonUtil::stripSlashes($_POST['login'])), 'passwd' => $this->B->db->escape(md5($_POST['passwd'])), 'rights' => 1, 'status' => 1));
// add new user data
if (FALSE !== ($user_id = $this->B->M(MOD_USER, 'add', $_data))) {
@header('Location: ' . SF_BASE_LOCATION . '/index.php?admin=1&m=user&sec=edituser&uid=' . $user_id);
exit;
} else {
$this->_reset_old_fields_data();
return TRUE;
}
}
return TRUE;
}
示例2: perform
/**
* Evaluate the option requests of the option template
*
* @param array $data
*/
function perform($data)
{
// Init this variable
$this->B->modul_options = FALSE;
// update the main options on demande
$this->_update_main_options();
// update options of other modules
$this->B->B('set_options');
// if some config are modified, write the config file and reload the page
if ($this->B->_modified == TRUE) {
$this->B->M(MOD_COMMON, 'sys_update_config', $this->B->sys);
@header('Location: ' . SF_BASE_LOCATION . '/index.php?admin=1&m=option');
exit;
}
// update language bad words list
$this->_update_bad_words_list();
// assign tpl array with available public template groups
$this->_load_public_tpl_groups();
// assign tpl array with available bad word lists
$this->_get_bad_words_list();
// Load options templates from other modules
$this->B->mod_option = array();
$this->B->B('get_options');
return TRUE;
}
示例3: perform
/**
* Execute the view of the template "addlist.tpl.php"
*
* @return bool true on success else false
*/
function perform()
{
if (isset($_POST['addlist'])) {
// Init form field values
$this->B->form_error = FALSE;
$this->B->form_name = '';
$this->B->form_emailserver = '';
$this->B->form_email = '';
$this->B->form_description = '';
$this->B->form_status = '';
// Check if some form fields are empty
if (empty($_POST['name']) || empty($_POST['emailserver']) || empty($_POST['email'])) {
$this->B->form_error = 'You have fill out the fields: name, emailserver, email !';
$this->_reset_old_fields_data();
return TRUE;
} else {
// add new email list
$this->B->tmp_data = array('name' => $this->B->db->escape(commonUtil::stripSlashes($_POST['name'])), 'emailserver' => $this->B->db->escape(commonUtil::stripSlashes($_POST['emailserver'])), 'email' => $this->B->db->escape(commonUtil::stripSlashes($_POST['email'])), 'description' => $this->B->db->escape(commonUtil::stripSlashes($_POST['description'])), 'folder' => $this->B->db->escape($list_folder), 'status' => (int) $_POST['status']);
if (TRUE === $this->B->M(MOD_EARCHIVE, 'add_list', $this->B->tmp_data)) {
@header('Location: ' . SF_BASE_LOCATION . '/index.php?admin=1&m=earchive');
exit;
} else {
$this->B->form_error = 'An unexpected error occured. Please check error_log!';
$this->_reset_old_fields_data();
return TRUE;
}
}
}
return TRUE;
}
示例4: perform
/**
* Execute the view of the template "group_register.tpl.php"
*
* @return bool true on success else false
*/
function perform()
{
// check if option allow_register is not set
if ($this->B->sys['option']['user']['allow_register'] == FALSE) {
@header('Location: ' . SF_BASE_LOCATION . '/index.php');
exit;
}
// init template vars
$this->B->tpl_error = FALSE;
$this->B->tpl_success = NULL;
// create capcha picture and public key
$this->B->M(MOD_USER, 'captcha_make', array('captcha_pic' => 'tpl_captcha_pic', 'public_key' => 'tpl_public_key'));
if ($_POST['do_register']) {
// validate captcha turing/public keys
if (FALSE === $this->B->M(MOD_USER, 'captcha_validate', array('turing_key' => $_POST['captcha_turing_key'], 'public_key' => $_POST['captcha_public_key']))) {
$this->B->tpl_error = '- Wrong turing key<br /><br />';
$this->_reset_form_data();
return TRUE;
}
if (FALSE == $this->B->M(MOD_USER, 'register', array('register' => $_POST['do_register'], 'error_var' => 'tpl_error', 'email_subject' => 'Your Earchive registration', 'email_msg' => 'You have to click on the link below to activate your account:<br /><br />(URL)<br /><br />Please contact the administrator on problems: (EMAIL).', 'reg_data' => array('login' => $_POST['login'], 'passwd1' => $_POST['passwd1'], 'passwd2' => $_POST['passwd2'], 'forename' => $_POST['forename'], 'lastname' => $_POST['lastname'], 'email' => $_POST['email'])))) {
$this->B->tpl_success = 'fail';
$this->_reset_form_data();
return TRUE;
}
$this->B->tpl_success = 'ok';
}
return TRUE;
}
示例5: perform
/**
* Execute the view of the template "group_search.tpl.php"
*
* @return bool true on success else false
*/
function perform()
{
//get all available email lists and store the result in the array $B->tpl_list
$this->B->M(MOD_EARCHIVE, 'get_lists', array('var' => 'tpl_list', 'fields' => array('lid', 'name', 'email', 'description', 'status')));
//get the messages of the searching result and store the result in the array $B->tpl_msg
$this->B->M(MOD_EARCHIVE, 'search', array('var' => 'tpl_msg', 'search' => $_REQUEST['search'], 'bool' => 'and', 'order' => 'mdate desc', 'limit' => 100, 'fields' => array('mid', 'lid', 'subject', 'sender', 'mdate'), 'get_list' => TRUE));
return TRUE;
}
示例6: perform
/**
* Check if version number has changed and perfom additional upgarde code
* Furthermore assign array with module menu names for the top right
* module html seletor
*
* @param array $data
*/
function perform($data)
{
// get os related separator to set include path
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
$tmp_separator = ';';
} else {
$tmp_separator = ':';
}
// set include path to the PEAR packages
ini_set('include_path', SF_BASE_DIR . 'modules/common/PEAR' . $tmp_separator . ini_get('include_path'));
unset($tmp_separator);
// include PEAR DB class
include_once SF_BASE_DIR . 'modules/common/PEAR/MDB2.php';
// init system config array
$this->B->sys = array();
// include system config array $this->B->sys
if (file_exists(SF_BASE_DIR . 'modules/common/config/config.php')) {
include_once SF_BASE_DIR . 'modules/common/config/config.php';
}
// if setup was done
if ($this->B->sys['info']['status'] == TRUE) {
$this->B->dsn = array('phptype' => $this->B->sys['db']['type'], 'username' => $this->B->sys['db']['user'], 'password' => $this->B->sys['db']['passwd'], 'hostspec' => $this->B->sys['db']['host'], 'database' => $this->B->sys['db']['name']);
$this->B->db =& MDB2::connect($this->B->dsn);
if (MDB2::isError($this->B->db)) {
trigger_error('Cannot connect to the database: ' . __FILE__ . ' ' . __LINE__, E_USER_ERROR);
}
} else {
// switch to the admin section if we comes from the public section
if (SF_SECTION == 'public') {
@header('Location: ' . SF_BASE_LOCATION . '/index.php?admin=1');
exit;
}
// launch setup screen
include $this->B->M(MOD_COMMON, 'get_module_view', array('m' => 'setup', 'view' => 'index'));
// Send the output buffer to the client
ob_end_flush();
exit;
}
// Check for upgrade
if (MOD_COMMON_VERSION != (string) $this->B->sys['module']['common']['version']) {
// set the new version num of this module
$this->B->sys['module']['common']['version'] = MOD_COMMON_VERSION;
$this->B->system_update_flag = TRUE;
// include here additional upgrade code
}
if (SF_SECTION == 'admin') {
// sort handler array by name
ksort($this->B->handler_list);
// assign template handler names array
// this array is used to build the modul select form of the admin menu
$this->B->tpl_mod_list = array();
foreach ($this->B->handler_list as $key => $value) {
if ($value['menu_visibility'] == TRUE) {
$this->B->tpl_mod_list[$key] = $value;
}
}
}
}
示例7: perform
/**
* Execute the view of the template "group_validate.tpl.php"
*
* @return bool true on success else false
*/
function perform()
{
$this->B->tpl_is_valid = $this->B->M(MOD_USER, 'validate', array('md5_str' => $_GET['usr_id']));
if (TRUE === $this->B->tpl_is_valid) {
$this->B->tpl_validation_message = 'Your account is now active.';
} else {
$this->B->tpl_validation_message = 'Account activation fails!!!';
}
return TRUE;
}
示例8: perform
/**
* Check if version number has changed and perfom additional upgarde code
* Furthermore assign array with module menu names for the top right
* module html seletor
*
* @param array $data
*/
function perform($data)
{
// check for install or upgrade
if (MOD_EARCHIVE_VERSION != (string) $this->B->sys['module']['earchive']['version']) {
// set the new version num of this module
$this->B->sys['module']['earchive']['version'] = MOD_EARCHIVE_VERSION;
$this->B->system_update_flag = TRUE;
$this->B->M(MOD_EARCHIVE, 'upgrade');
}
}
示例9: perform
/**
* Execute the view of the template "group_message.tpl.php"
*
* @return bool true on success else false
* @todo validate $_GET['mid']
*/
function perform()
{
/* get all available email lists and store the result in the array $B->tpl_list */
$this->B->M(MOD_EARCHIVE, 'get_lists', array('var' => 'tpl_list', 'fields' => array('lid', 'name', 'email', 'description', 'status')));
/* get the requested message and store the result in the array $B->tpl_msg
assign template vars with message data */
$this->B->M(MOD_EARCHIVE, 'get_message', array('mid' => (int) $_GET['mid'], 'var' => 'tpl_msg', 'fields' => array('subject', 'sender', 'mdate', 'body', 'folder')));
/* get the message attachments and store the result in the array $B->tpl_attach */
$this->B->M(MOD_EARCHIVE, 'get_attachments', array('var' => 'tpl_attach', 'mid' => (int) $_GET['mid'], 'fields' => array('aid', 'mid', 'lid', 'file', 'size', 'type')));
return TRUE;
}
示例10: perform
/**
* Check if version number has changed and perfom additional upgarde code
*
* @param array $data
*/
function perform($data)
{
// Check for upgrade
if (MOD_USER_VERSION != (string) $this->B->sys['module']['user']['version']) {
// set the new version num of this module
$this->B->sys['module']['user']['version'] = MOD_USER_VERSION;
$this->B->system_update_flag = TRUE;
$this->B->M(MOD_USER, 'upgrade');
// include here additional upgrade code
}
}
示例11: perform
/**
* Execute the view of the template "group_list.tpl.php"
*
* @return bool true on success else false
* @todo validate $_GET['lid']
*/
function perform()
{
/* check if registered user is required to access this list */
$this->B->M(MOD_EARCHIVE, 'have_access', array('lid' => (int) $_GET['lid']));
/* get all available email lists and store the result in the array $B->tpl_list */
$this->B->M(MOD_EARCHIVE, 'get_lists', array('var' => 'tpl_list', 'fields' => array('lid', 'name', 'email', 'description', 'status')));
/* get the messages of the requested email list and store the result in the array $B->tpl_msg
assign template vars with message data */
$this->B->M(MOD_EARCHIVE, 'get_messages', array('lid' => (int) $_GET['lid'], 'var' => 'tpl_msg', 'fields' => array('mid', 'lid', 'subject', 'sender', 'mdate'), 'order' => 'mdate DESC', 'pager' => array('var' => 'tpl_prevnext', 'limit' => 15, 'delta' => 3)));
return TRUE;
}
示例12: perform
/**
* Check if registered user is required to access list with status 3
*
* @param array $data
*/
function perform(&$data)
{
/* get list status */
$this->B->M(MOD_EARCHIVE, 'get_list', array('lid' => $data['lid'], 'var' => 'tmp_list', 'fields' => array('status')));
if ($this->B->tmp_list['status'] == 3 && $this->B->is_logged === FALSE) {
$query = base64_encode($this->_getQueryString());
@header('Location: ' . SF_BASE_LOCATION . '/index.php?view=login&url=' . $query);
exit;
}
return TRUE;
}
示例13: perform
/**
* Execute the view of the template "group_attach.tpl.php"
*
* @return bool true on success else false
* @todo validate $_GET['mid']
*/
function perform()
{
//Get the demanded attachment and send it to the client
//get the top requested email list attachment folder
$this->B->M(MOD_EARCHIVE, 'get_list', array('var' => 'tpl_list', 'lid' => (int) $_GET['lid'], 'fields' => array('folder')));
//get the requested message attachment folder
$this->B->M(MOD_EARCHIVE, 'get_message', array('var' => 'tpl_msg', 'mid' => (int) $_GET['mid'], 'lid' => (int) $_GET['lid'], 'fields' => array('folder')));
//get the attachment file name, type
$this->B->M(MOD_EARCHIVE, 'get_attach', array('var' => 'tpl_attach', 'aid' => (int) $_GET['aid'], 'mid' => (int) $_GET['mid'], 'lid' => (int) $_GET['lid'], 'fields' => array('file', 'type')));
// set params to send http header and content
$this->B->attach_params = array('file' => './data/earchive/' . $this->B->tpl_list['folder'] . '/' . $this->B->tpl_msg['folder'] . '/' . stripslashes($this->B->tpl_attach['file']), 'contenttype' => $this->B->tpl_attach['type'], 'contentdisposition' => array(HTTP_DOWNLOAD_ATTACHMENT, stripslashes($this->B->tpl_attach['file'])));
return TRUE;
}
示例14: foreach
/**
* fetch all attachments from a message
*
* @param int $mid message id
* @param array $account account data
*/
function _fetch_attach($message_id, $mid, $account, $_folder)
{
// check if there are attachments attachments
if (!isset($this->_msg->msg[$mid]['at']['pid']) && count($this->_msg->msg[$mid]['at']['pid']) == 0) {
return TRUE;
} else {
$path = SF_BASE_DIR . 'data/earchive/' . $account['folder'] . '/' . $_folder;
if (!@mkdir($path, SF_DIR_MODE)) {
trigger_error('Unable to create list message folder', E_USER_ERROR);
}
foreach ($this->_msg->msg[$mid]['at']['pid'] as $i => $aid) {
$att_data = array();
$body = $this->_msg->getBody($mid, $this->_msg->msg[$mid]['at']['pid'][$i]);
$_file = $this->_decodeEmailHeader($this->_msg->msg[$mid]['at']['fname'][$i]);
$att_data['path_file'] = $path . '/' . $_file;
$att_data['file'] = $this->B->db->escape($_file);
$att_data['type'] = $this->B->db->escape($this->_msg->msg[$mid]['at']['ftype'][$i]);
$att_data['size'] = $this->_msg->msg[$mid]['at']['fsize'][$i];
$att_data['mid'] = $message_id;
$att_data['lid'] = $account['lid'];
$att_data['content'] = $body['message'];
$this->B->M(MOD_EARCHIVE, 'add_attach', $att_data);
}
}
return TRUE;
}
示例15: perform
/**
* Execute the view of the template "index.tpl.php"
* create the template variables
* and listen to an action
*
* @return bool true on success else false
*/
function perform()
{
// create capcha picture and public key
$this->B->M(MOD_USER, 'captcha_make', array('captcha_pic' => 'tpl_captcha_pic', 'public_key' => 'tpl_public_key'));
// Check login data
if (isset($_POST['login'])) {
// validate captcha turing/public keys
if (FALSE === $this->B->M(MOD_USER, 'captcha_validate', array('turing_key' => $_POST['captcha_turing_key'], 'public_key' => $_POST['captcha_public_key']))) {
$this->B->tpl_error = 'Wrong turing key!!<br /><br />';
$this->_reset_form_data();
return TRUE;
}
$this->B->M(MOD_USER, 'check_login', array('login' => $_POST['login_name'], 'passwd' => $_POST['password'], 'forward_url' => $_REQUEST['url']));
}
return TRUE;
}