本文整理汇总了PHP中josSpoofCheck函数的典型用法代码示例。如果您正苦于以下问题:PHP josSpoofCheck函数的具体用法?PHP josSpoofCheck怎么用?PHP josSpoofCheck使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了josSpoofCheck函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveSyndicate
/**
* Saves the record from an edit form submit
* @param string The current GET/POST option
*/
function saveSyndicate($option)
{
global $database;
josSpoofCheck();
$params = mosGetParam($_POST, 'params', '');
if (is_array($params)) {
$txt = array();
foreach ($params as $k => $v) {
$txt[] = "{$k}={$v}";
}
$_POST['params'] = mosParameters::textareaHandling($txt);
}
$id = intval(mosGetParam($_POST, 'id', '17'));
$row = new mosComponent($database);
$row->load($id);
if (!$row->bind($_POST)) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
if (!$row->check()) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
if (!$row->store()) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
$msg = 'Settings successfully Saved';
mosRedirect('index2.php?option=' . $option, $msg);
}
示例2: pollAddVote
function pollAddVote($uid)
{
global $database;
// simple spoof check security
josSpoofCheck(0, 'poll');
$redirect = 1;
$sessionCookieName = mosMainFrame::sessionCookieName();
$sessioncookie = mosGetParam($_REQUEST, $sessionCookieName, '');
if (!$sessioncookie) {
echo '<h3>' . _ALERT_ENABLED . '</h3>';
echo '<input class="button" type="button" value="' . _CMN_CONTINUE . '" onClick="window.history.go(-1);">';
return;
}
$poll = new mosPoll($database);
if (!$poll->load((int) $uid)) {
echo '<h3>' . _NOT_AUTH . '</h3>';
echo '<input class="button" type="button" value="' . _CMN_CONTINUE . '" onClick="window.history.go(-1);">';
return;
}
$cookiename = "voted{$poll->id}";
$voted = mosGetParam($_COOKIE, $cookiename, '0');
if ($voted) {
echo "<h3>" . _ALREADY_VOTE . "</h3>";
echo "<input class=\"button\" type=\"button\" value=\"" . _CMN_CONTINUE . "\" onClick=\"window.history.go(-1);\">";
return;
}
$voteid = intval(mosGetParam($_POST, 'voteid', 0));
if (!$voteid) {
echo "<h3>" . _NO_SELECTION . "</h3>";
echo '<input class="button" type="button" value="' . _CMN_CONTINUE . '" onClick="window.history.go(-1);">';
return;
}
setcookie($cookiename, '1', time() + $poll->lag);
$query = "UPDATE #__poll_data" . "\n SET hits = hits + 1" . "\n WHERE pollid = " . (int) $poll->id . "\n AND id = " . (int) $voteid;
$database->setQuery($query);
$database->query();
$query = "UPDATE #__polls" . "\n SET voters = voters + 1" . "\n WHERE id = " . (int) $poll->id;
$database->setQuery($query);
$database->query();
$now = _CURRENT_SERVER_TIME;
$query = "INSERT INTO #__poll_date" . "\n SET date = " . $database->Quote($now) . ", vote_id = " . (int) $voteid . ", poll_id = " . (int) $poll->id;
$database->setQuery($query);
$database->query();
if ($redirect) {
mosRedirect(sefRelToAbs('index.php?option=com_poll&task=results&id=' . $uid), _THANKS);
} else {
echo '<h3>' . _THANKS . '</h3>';
echo '<form action="" method="GET">';
echo '<input class="button" type="button" value="' . _BUTTON_RESULTS . '" onClick="window.location=\'' . sefRelToAbs('index.php?option=com_poll&task=results&id=' . $uid) . '\'">';
echo '</form>';
}
}
示例3: sendMail
function sendMail()
{
global $database, $my, $acl;
global $mosConfig_sitename;
global $mosConfig_mailfrom, $mosConfig_fromname;
josSpoofCheck();
$mode = intval(mosGetParam($_POST, 'mm_mode', 0));
$subject = strval(mosGetParam($_POST, 'mm_subject', ''));
$gou = mosGetParam($_POST, 'mm_group', NULL);
$recurse = strval(mosGetParam($_POST, 'mm_recurse', 'NO_RECURSE'));
// pulls message inoformation either in text or html format
if ($mode) {
$message_body = $_POST['mm_message'];
} else {
// automatically removes html formatting
$message_body = strval(mosGetParam($_POST, 'mm_message', ''));
}
$message_body = stripslashes($message_body);
if (!$message_body || !$subject || $gou === null) {
mosRedirect('index2.php?option=com_massmail&mosmsg=Please fill in the form correctly');
}
// get users in the group out of the acl
$to = $acl->get_group_objects($gou, 'ARO', $recurse);
$rows = array();
if (count($to['users']) || $gou === '0') {
// Get sending email address
$query = "SELECT email" . "\n FROM #__users" . "\n WHERE id = " . (int) $my->id;
$database->setQuery($query);
$my->email = $database->loadResult();
mosArrayToInts($to['users']);
$user_ids = 'id=' . implode(' OR id=', $to['users']);
// Get all users email and group except for senders
$query = "SELECT email" . "\n FROM #__users" . "\n WHERE id != " . (int) $my->id . ($gou !== '0' ? " AND ( {$user_ids} )" : '');
$database->setQuery($query);
$rows = $database->loadObjectList();
// Build e-mail message format
$message_header = sprintf(_MASSMAIL_MESSAGE, html_entity_decode($mosConfig_sitename, ENT_QUOTES));
$message = $message_header . $message_body;
$subject = html_entity_decode($mosConfig_sitename, ENT_QUOTES) . ' / ' . stripslashes($subject);
//Send email
foreach ($rows as $row) {
mosMail($mosConfig_mailfrom, $mosConfig_fromname, $row->email, $subject, $message, $mode);
}
}
$msg = 'E-mail sent to ' . count($rows) . ' users';
mosRedirect('index2.php?option=com_massmail', $msg);
}
示例4: uninstall
/**
* Custom install method
* @param int The id of the module
* @param string The URL option
* @param int The client id
*/
function uninstall($id, $option, $client = 0)
{
global $database, $mosConfig_absolute_path;
josSpoofCheck(null, null, 'request');
// Delete directories
$path = $mosConfig_absolute_path . ($client == 'admin' ? '/administrator' : '') . '/templates/' . $id;
$id = str_replace('..', '', $id);
if (trim($id)) {
if (is_dir($path)) {
return deldir(mosPathName($path));
} else {
HTML_installer::showInstallMessage('Directory does not exist, cannot remove files', 'Uninstall - error', $this->returnTo($option, 'template', $client));
}
} else {
HTML_installer::showInstallMessage('Template id is empty, cannot remove files', 'Uninstall - error', $this->returnTo($option, 'template', $client));
exit;
}
}
示例5: saveConfigSource
function saveConfigSource($option)
{
josSpoofCheck();
//$filecontent = mosGetParam( $_POST, 'filecontent', '', _MOS_ALLOWHTML );
$filecontent = isset($_POST['filecontent']) ? strval($_POST['filecontent']) : '';
$filecontent = get_magic_quotes_gpc() ? stripslashes($filecontent) : $filecontent;
// var_dump($filecontent);die;
if ($filecontent) {
$file = JPATH_SITE . '/components/com_joomla_lms/includes/config.inc.php';
$enable_write = mosGetParam($_POST, 'enable_write', 0);
$oldperms = fileperms($file);
if ($enable_write) {
@chmod($file, $oldperms | 0222);
}
clearstatcache();
if (is_writable($file) == false) {
mosRedirect('index.php?option=' . $option . '&task=dev_config', str_replace('{file}', $file, _JLMS_CFG_MSG_F_NOT_WRITABLE));
}
if ($fp = fopen($file, 'w')) {
fputs($fp, $filecontent, strlen($filecontent));
fclose($fp);
if ($enable_write) {
@chmod($file, $oldperms);
} else {
if (mosGetParam($_POST, 'disable_write', 0)) {
@chmod($file, $oldperms & 0777555);
}
}
// if
mosRedirect('index.php?option=' . $option . '&task=dev_config');
} else {
if ($enable_write) {
@chmod($file, $oldperms);
}
mosRedirect('index.php?option=' . $option . '&task=dev_config', _JLMS_CFG_MSG_F_FAILD_TO_OPEN);
}
} else {
mosRedirect('index.php?option=' . $option . '&task=dev_config', _JLMS_CFG_MSG_UNKNOWN_ERROR);
}
}
示例6: uninstall
/**
* Custom install method
* @param int The id of the module
* @param string The URL option
* @param int The client id
*/
function uninstall($id, $option, $client = 0)
{
global $mosConfig_absolute_path;
josSpoofCheck(null, null, 'request');
$id = str_replace(array('\\', '/'), '', $id);
$basepath = $mosConfig_absolute_path . '/language/';
$xmlfile = $basepath . $id . '.xml';
// see if there is an xml install file, must be same name as element
if (file_exists($xmlfile)) {
$this->i_xmldoc = new DOMIT_Lite_Document();
$this->i_xmldoc->resolveErrors(true);
if ($this->i_xmldoc->loadXML($xmlfile, false, true)) {
$mosinstall =& $this->i_xmldoc->documentElement;
// get the files element
$files_element =& $mosinstall->getElementsByPath('files', 1);
if (!is_null($files_element)) {
$files = $files_element->childNodes;
foreach ($files as $file) {
// delete the files
$filename = $file->getText();
echo $filename;
if (file_exists($basepath . $filename)) {
echo '<br />Deletando: ' . $basepath . $filename;
$result = unlink($basepath . $filename);
}
echo intval($result);
}
}
}
} else {
HTML_installer::showInstallMessage('ID do idioma vazio, não é possível remover arquivos', 'Desistalação - erro', $this->returnTo($option, 'language', $client));
exit;
}
// remove XML file from front
@unlink($xmlfile);
return true;
}
示例7: checkToken
public static function checkToken($method = 'post')
{
if (JCOMMENTS_JVERSION == '1.5') {
JRequest::checkToken($method) or jexit('Invalid Token');
} else {
if (JCOMMENTS_JVERSION == '1.7') {
JRequest::checkToken($method) or jexit(JText::_('JINVALID_TOKEN'));
} else {
josSpoofCheck(null, null, $method);
}
}
}
示例8: saveRegistration
function saveRegistration()
{
global $database, $acl;
global $mosConfig_sitename, $mosConfig_live_site, $mosConfig_useractivation, $mosConfig_allowUserRegistration;
global $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_mailfrom, $mosConfig_fromname;
if ($mosConfig_allowUserRegistration == 0) {
mosNotAuth();
return;
}
// simple spoof check security
josSpoofCheck();
$row = new mosUser($database);
if (!$row->bind($_POST, 'usertype')) {
mosErrorAlert($row->getError());
}
$row->name = trim($row->name);
$row->email = trim($row->email);
$row->username = trim($row->username);
$row->password = trim($row->password);
mosMakeHtmlSafe($row);
$row->id = 0;
$row->usertype = '';
$row->gid = $acl->get_group_id('Registered', 'ARO');
if ($mosConfig_useractivation == 1) {
$row->activation = md5(mosMakePassword());
$row->block = '1';
}
if (!$row->check()) {
echo "<script> alert('" . html_entity_decode($row->getError()) . "'); window.history.go(-1); </script>\n";
exit;
}
$pwd = $row->password;
$salt = mosMakePassword(16);
$crypt = md5($row->password . $salt);
$row->password = $crypt . ':' . $salt;
$row->registerDate = date('Y-m-d H:i:s');
if (!$row->store()) {
echo "<script> alert('" . html_entity_decode($row->getError()) . "'); window.history.go(-1); </script>\n";
exit;
}
$row->checkin();
$name = trim($row->name);
$email = trim($row->email);
$username = trim($row->username);
$subject = sprintf(_SEND_SUB, $name, $mosConfig_sitename);
$subject = html_entity_decode($subject, ENT_QUOTES);
if ($mosConfig_useractivation == 1) {
$message = sprintf(_USEND_MSG_ACTIVATE, $name, $mosConfig_sitename, $mosConfig_live_site . "/index.php?option=com_registration&task=activate&activation=" . $row->activation, $mosConfig_live_site, $username, $pwd);
} else {
$message = sprintf(_USEND_MSG, $name, $mosConfig_sitename, $mosConfig_live_site);
}
$message = html_entity_decode($message, ENT_QUOTES);
// check if Global Config `mailfrom` and `fromname` values exist
if ($mosConfig_mailfrom != '' && $mosConfig_fromname != '') {
$adminName2 = $mosConfig_fromname;
$adminEmail2 = $mosConfig_mailfrom;
} else {
// use email address and name of first superadmin for use in email sent to user
$query = "SELECT name, email" . "\n FROM #__users" . "\n WHERE LOWER( usertype ) = 'superadministrator'" . "\n OR LOWER( usertype ) = 'super administrator'";
$database->setQuery($query);
$rows = $database->loadObjectList();
$row2 = $rows[0];
$adminName2 = $row2->name;
$adminEmail2 = $row2->email;
}
// Send email to user
mosMail($adminEmail2, $adminName2, $email, $subject, $message);
// Send notification to all administrators
$subject2 = sprintf(_SEND_SUB, $name, $mosConfig_sitename);
$message2 = sprintf(_ASEND_MSG, $adminName2, $mosConfig_sitename, $row->name, $email, $username);
$subject2 = html_entity_decode($subject2, ENT_QUOTES);
$message2 = html_entity_decode($message2, ENT_QUOTES);
// get email addresses of all admins and superadmins set to recieve system emails
$query = "SELECT email, sendEmail" . "\n FROM #__users" . "\n WHERE ( gid = 24 OR gid = 25 )" . "\n AND sendEmail = 1" . "\n AND block = 0";
$database->setQuery($query);
$admins = $database->loadObjectList();
foreach ($admins as $admin) {
// send email to admin & super admin set to recieve system emails
mosMail($adminEmail2, $adminName2, $admin->email, $subject2, $message2);
}
if ($mosConfig_useractivation == 1) {
echo _REG_COMPLETE_ACTIVATE;
} else {
echo _REG_COMPLETE;
}
}
示例9: cancelPoll
function cancelPoll($option)
{
josSpoofCheck();
global $database;
$row = new mosPoll($database);
$row->bind($_POST);
$row->checkin();
mosRedirect('index2.php?option=' . $option);
}
示例10: sendmail
function sendmail($con_id, $option)
{
global $mainframe, $database, $Itemid;
global $mosConfig_sitename, $mosConfig_live_site, $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_db;
// simple spoof check security
josSpoofCheck(1);
$query = "SELECT *" . "\n FROM #__contact_details" . "\n WHERE id = " . (int) $con_id;
$database->setQuery($query);
$contact = $database->loadObjectList();
if (count($contact) > 0) {
$default = $mosConfig_sitename . ' ' . _ENQUIRY;
$email = strval(mosGetParam($_POST, 'email', ''));
$text = strval(mosGetParam($_POST, 'text', ''));
$name = strval(mosGetParam($_POST, 'name', ''));
$subject = strval(mosGetParam($_POST, 'subject', $default));
$email_copy = strval(mosGetParam($_POST, 'email_copy', 0));
$menu = $mainframe->get('menu');
$mparams = new mosParameters($menu->params);
$bannedEmail = $mparams->get('bannedEmail', '');
$bannedSubject = $mparams->get('bannedSubject', '');
$bannedText = $mparams->get('bannedText', '');
$sessionCheck = $mparams->get('sessionCheck', 1);
// check for session cookie
if ($sessionCheck) {
// Session Cookie `name`
$sessionCookieName = mosMainFrame::sessionCookieName();
// Get Session Cookie `value`
$sessioncookie = mosGetParam($_COOKIE, $sessionCookieName, null);
if (!(strlen($sessioncookie) == 32 || $sessioncookie == '-')) {
mosErrorAlert(_NOT_AUTH);
}
}
// Prevent form submission if one of the banned text is discovered in the email field
if ($bannedEmail) {
$bannedEmail = explode(';', $bannedEmail);
foreach ($bannedEmail as $value) {
if (stristr($email, $value)) {
mosErrorAlert(_NOT_AUTH);
}
}
}
// Prevent form submission if one of the banned text is discovered in the subject field
if ($bannedSubject) {
$bannedSubject = explode(';', $bannedSubject);
foreach ($bannedSubject as $value) {
if (stristr($subject, $value)) {
mosErrorAlert(_NOT_AUTH);
}
}
}
// Prevent form submission if one of the banned text is discovered in the text field
if ($bannedText) {
$bannedText = explode(';', $bannedText);
foreach ($bannedText as $value) {
if (stristr($text, $value)) {
mosErrorAlert(_NOT_AUTH);
}
}
}
// test to ensure that only one email address is entered
$check = explode('@', $email);
if (strpos($email, ';') || strpos($email, ',') || strpos($email, ' ') || count($check) > 2) {
mosErrorAlert(_CONTACT_MORE_THAN);
}
if (!$email || !$text || JosIsValidEmail($email) == false) {
mosErrorAlert(_CONTACT_FORM_NC);
}
$prefix = sprintf(_ENQUIRY_TEXT, $mosConfig_live_site);
$text = $prefix . "\n" . $name . ' <' . $email . '>' . "\n\n" . stripslashes($text);
$success = mosMail($email, $name, $contact[0]->email_to, $mosConfig_fromname . ': ' . $subject, $text);
if (!$success) {
mosErrorAlert(_CONTACT_FORM_NC);
}
// parameter check
$params = new mosParameters($contact[0]->params);
$emailcopyCheck = $params->get('email_copy', 0);
// check whether email copy function activated
if ($email_copy && $emailcopyCheck) {
$copy_text = sprintf(_COPY_TEXT, $contact[0]->name, $mosConfig_sitename);
$copy_text = $copy_text . "\n\n" . $text . '';
$copy_subject = _COPY_SUBJECT . $subject;
$success = mosMail($mosConfig_mailfrom, $mosConfig_fromname, $email, $copy_subject, $copy_text);
if (!$success) {
mosErrorAlert(_CONTACT_FORM_NC);
}
}
$link = sefRelToAbs('index.php?option=com_contact&task=view&contact_id=' . $contact[0]->id . '&Itemid=' . $Itemid);
mosRedirect($link, _THANK_MESSAGE);
}
}
示例11: cancelWeblink
/**
* Cancels an edit operation
* @param string The current url option
*/
function cancelWeblink($option)
{
josSpoofCheck();
global $database;
$row = new mosWeblink($database);
$row->bind($_POST);
$row->checkin();
mosRedirect("index2.php?option={$option}");
}
示例12: saveOrder
function saveOrder(&$cid)
{
global $database;
josSpoofCheck();
$total = count($cid);
$order = josGetArrayInts('order');
$row = new mosContent($database);
$conditions = array();
// update ordering values
for ($i = 0; $i < $total; $i++) {
$row->load((int) $cid[$i]);
if ($row->ordering != $order[$i]) {
$row->ordering = $order[$i];
if (!$row->store()) {
echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
exit;
}
// if
// remember to updateOrder this group
$condition = "catid=" . (int) $row->catid . " AND state >= 0";
$found = false;
foreach ($conditions as $cond) {
if ($cond[1] == $condition) {
$found = true;
break;
}
}
// if
if (!$found) {
$conditions[] = array($row->id, $condition);
}
}
// if
}
// for
// execute updateOrder for each group
foreach ($conditions as $cond) {
$row->load($cond[0]);
$row->updateOrder($cond[1]);
}
// foreach
// clean any existing cache files
mosCache::cleanCache('com_content');
$msg = 'New ordering saved';
mosRedirect('index2.php?option=com_typedcontent', $msg);
}
示例13: userSave
function userSave($option, $uid)
{
global $database, $my, $mosConfig_frontend_userparams;
$user_id = intval(mosGetParam($_POST, 'id', 0));
// do some security checks
if ($uid == 0 || $user_id == 0 || $user_id != $uid) {
mosNotAuth();
return;
}
// simple spoof check security
josSpoofCheck();
$row = new mosUser($database);
$row->load((int) $user_id);
$orig_password = $row->password;
$orig_username = $row->username;
if (!$row->bind($_POST, 'gid usertype')) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
$row->name = trim($row->name);
$row->email = trim($row->email);
$row->username = trim($row->username);
mosMakeHtmlSafe($row);
if (isset($_POST['password']) && $_POST['password'] != '') {
if (isset($_POST['verifyPass']) && $_POST['verifyPass'] == $_POST['password']) {
$row->password = trim($row->password);
$salt = mosMakePassword(16);
$crypt = md5($row->password . $salt);
$row->password = $crypt . ':' . $salt;
} else {
echo "<script> alert(\"" . addslashes(_PASS_MATCH) . "\"); window.history.go(-1); </script>\n";
exit;
}
} else {
// Restore 'original password'
$row->password = $orig_password;
}
if ($mosConfig_frontend_userparams == '1' || $mosConfig_frontend_userparams == 1 || $mosConfig_frontend_userparams == NULL) {
// save params
$params = mosGetParam($_POST, 'params', '');
if (is_array($params)) {
$txt = array();
foreach ($params as $k => $v) {
$txt[] = "{$k}={$v}";
}
$row->params = implode("\n", $txt);
}
}
if (!$row->check()) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
if (!$row->store()) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
// check if username has been changed
if ($orig_username != $row->username) {
// change username value in session table
$query = "UPDATE #__session" . "\n SET username = " . $database->Quote($row->username) . "\n WHERE username = " . $database->Quote($orig_username) . "\n AND userid = " . (int) $my->id . "\n AND gid = " . (int) $my->gid . "\n AND guest = 0";
$database->setQuery($query);
$database->query();
}
mosRedirect('index.php', _USER_DETAILS_SAVE);
}
示例14: uninstall
/**
* Custom install method
* @param int The id of the module
* @param string The URL option
* @param int The client id
*/
function uninstall($id, $option, $client = 0)
{
global $database, $mosConfig_absolute_path;
josSpoofCheck();
$id = intval($id);
$query = "SELECT module, iscore, client_id" . "\n FROM #__modules WHERE id = " . (int) $id;
$database->setQuery($query);
$row = null;
$database->loadObject($row);
if ($row->iscore) {
HTML_installer::showInstallMessage($row->title . 'é um elemento do sistema e não pode ser desinstalado.<br />Caso não o pretenda continuar a utilizar será necessário retirar de publicação', 'Desinstalar - erro', $this->returnTo($option, 'module', $row->client_id ? '' : 'admin'));
exit;
}
$query = "SELECT id" . "\n FROM #__modules" . "\n WHERE module = " . $database->Quote($row->module) . " AND client_id = " . (int) $row->client_id;
$database->setQuery($query);
$modules = $database->loadResultArray();
if (count($modules)) {
mosArrayToInts($modules);
$modID = 'moduleid=' . implode(' OR moduleid=', $modules);
$query = "DELETE FROM #__modules_menu" . "\n WHERE ( {$modID} )";
$database->setQuery($query);
if (!$database->query()) {
$msg = $database->stderr;
die($msg);
}
$query = "DELETE FROM #__modules" . "\n WHERE module = " . $database->Quote($row->module) . " AND client_id = " . (int) $row->client_id;
$database->setQuery($query);
if (!$database->query()) {
$msg = $database->stderr;
die($msg);
}
if (!$row->client_id) {
$basepath = $mosConfig_absolute_path . '/modules/';
} else {
$basepath = $mosConfig_absolute_path . '/administrator/modules/';
}
$xmlfile = $basepath . $row->module . '.xml';
// see if there is an xml install file, must be same name as element
if (file_exists($xmlfile)) {
$this->i_xmldoc = new DOMIT_Lite_Document();
$this->i_xmldoc->resolveErrors(true);
if ($this->i_xmldoc->loadXML($xmlfile, false, true)) {
$mosinstall =& $this->i_xmldoc->documentElement;
// get the files element
$files_element =& $mosinstall->getElementsByPath('files', 1);
if (!is_null($files_element)) {
$files = $files_element->childNodes;
foreach ($files as $file) {
// delete the files
$filename = $file->getText();
if (file_exists($basepath . $filename)) {
$parts = pathinfo($filename);
$subpath = $parts['dirname'];
if ($subpath != '' && $subpath != '.' && $subpath != '..') {
echo '<br />Deletado: ' . $basepath . $subpath;
$result = deldir(mosPathName($basepath . $subpath . '/'));
} else {
echo '<br />Deletado: ' . $basepath . $filename;
$result = unlink(mosPathName($basepath . $filename, false));
}
echo intval($result);
}
}
// remove XML file from front
echo "Deletando arquivo XML: {$xmlfile}";
@unlink(mosPathName($xmlfile, false));
return true;
}
}
}
}
}
示例15: removeMessage
function removeMessage($cid, $option)
{
global $database;
josSpoofCheck();
if (!is_array($cid) || count($cid) < 1) {
echo "<script> alert('Select an item to delete'); window.history.go(-1);</script>\n";
exit;
}
if (count($cid)) {
mosArrayToInts($cid);
$cids = 'message_id=' . implode(' OR message_id=', $cid);
$query = "DELETE FROM #__messages" . "\n WHERE ( {$cids} )";
$database->setQuery($query);
if (!$database->query()) {
echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
}
}
$limit = intval(mosGetParam($_REQUEST, 'limit', 10));
$limitstart = intval(mosGetParam($_REQUEST, 'limitstart', 0));
mosRedirect("index2.php?option={$option}&limit={$limit}&limitstart={$limitstart}");
}