Example #1
0
function sendNewPass($option)
{
    global $database, $Itemid;
    global $mosConfig_live_site, $mosConfig_sitename;
    $_live_site = $mosConfig_live_site;
    $_sitename = $mosConfig_sitename;
    // ensure no malicous sql gets past
    $checkusername = trim(mosGetParam($_POST, 'checkusername', ''));
    $checkusername = $database->getEscaped($checkusername);
    $confirmEmail = trim(mosGetParam($_POST, 'confirmEmail', ''));
    $confirmEmail = $database->getEscaped($confirmEmail);
    $database->setQuery("SELECT id FROM #__users" . "\nWHERE username='******' AND email='{$confirmEmail}'");
    if (!($user_id = $database->loadResult()) || !$checkusername || !$confirmEmail) {
        mosRedirect("index.php?option={$option}&task=lostPassword&mosmsg=" . _ERROR_PASS);
    }
    $database->setQuery("SELECT name, email FROM #__users" . "\n WHERE usertype='superadministrator'");
    $rows = $database->loadObjectList();
    foreach ($rows as $row) {
        $adminName = $row->name;
        $adminEmail = $row->email;
    }
    $newpass = mosMakePassword();
    $message = _NEWPASS_MSG;
    eval("\$message = \"{$message}\";");
    $subject = _NEWPASS_SUB;
    eval("\$subject = \"{$subject}\";");
    mosMail($mosConfig_mailfrom, $mosConfig_fromname, $confirmEmail, $subject, $message);
    $newpass = md5($newpass);
    $sql = "UPDATE #__users SET password='******' WHERE id='{$user_id}'";
    $database->setQuery($sql);
    if (!$database->query()) {
        die("SQL error" . $database->stderr(true));
    }
    mosRedirect("index.php?Itemid={$Itemid}&mosmsg=" . _NEWPASS_SENT);
}
Example #2
0
 function saveMenu($option)
 {
     global $database;
     $params = mosGetParam($_POST, 'params', '');
     $params[url] = mosGetParam($_POST, 'url', '');
     if (is_array($params)) {
         $txt = array();
         foreach ($params as $k => $v) {
             $txt[] = "{$k}={$v}";
         }
         $_POST['params'] = implode("\n", $txt);
     }
     $row = new mosMenu($database);
     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;
     }
     $row->checkin();
     $row->updateOrder("menutype='{$row->menutype}' AND parent='{$row->parent}'");
     mosRedirect("index2.php?option={$option}&menutype={$row->menutype}");
 }
Example #3
0
function sendMail()
{
    global $database, $my, $acl, $adminLanguage;
    global $mosConfig_sitename, $mosConfig_debug;
    global $mosConfig_mailfrom, $mosConfig_fromname;
    $n = 0;
    $message_body = mosGetParam($_POST, 'mm_message', '');
    $message_body = stripslashes($message_body);
    $subject = mosGetParam($_POST, 'mm_subject', '');
    $gou = mosGetParam($_POST, 'mm_group', NULL);
    $recurse = mosGetParam($_POST, 'mm_recurse', 'NO_RECURSE');
    if (!$message_body || !$subject || $gou === null) {
        mosRedirect("index2.php?option=com_massmail&mosmsg=" . $adminLanguage->A_COMP_MASS_FILL);
    }
    // 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
        $database->setQuery("SELECT email FROM #__users WHERE id='{$my->id}'");
        $my->email = $database->loadResult();
        // Get all users email and group except for senders
        $database->setQuery("SELECT email FROM #__users" . "\n WHERE id != '{$my->id}'" . ($gou !== '0' ? " AND id IN (" . implode(',', $to['users']) . ")" : ""));
        $rows = $database->loadObjectList();
        // Build e-mail message format
        $message_header = sprintf(_MASSMAIL_MESSAGE, $mosConfig_sitename);
        $message = $message_header . $message_body;
        $subject = $mosConfig_sitename . ' / ' . stripslashes($subject);
        //Send email
        foreach ($rows as $row) {
            mosMail($mosConfig_mailfrom, $mosConfig_fromname, $row->email, $subject, $message);
        }
    }
    mosRedirect("index2.php", $adminLanguage->A_COMP_MASS_SENT . " " . count($rows) . " " . $adminLanguage->A_COMP_MASS_USERS);
}
Example #4
0
File: poll.php Project: cwcw/cms
function pollAddVote($uid)
{
    global $database, $mosConfig_offset, $Itemid;
    /*
    	$params = new stdClass();
    	if ( $Itemid ) {
    		$component = new mosComponent( $database );
    		$component->load( $Itemid );
    		$params =& new mosParameters( $component->params ); 
    		$params->set( 'redirect', 1 );
    		$redirect = $params->get( 'redirect' );
    	}
    */
    $redirect = 1;
    $sessioncookie = mosGetParam($_REQUEST, 'sessioncookie', '');
    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($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 = 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);
    $database->setQuery("UPDATE #__poll_data SET hits=hits + 1" . "\n WHERE pollid='{$poll->id}' AND id='{$voteid}'");
    $database->query();
    $database->setQuery("UPDATE #__polls SET voters=voters + 1" . "\n WHERE id='{$poll->id}'");
    $database->query();
    $now = date("Y-m-d G:i:s");
    $database->setQuery("INSERT INTO #__poll_date SET date='{$now}', vote_id='{$voteid}',\tpoll_id='{$poll->id}'");
    $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>';
    }
}
Example #5
0
function clearData($cid = array())
{
    DOCMAN_token::check() or die('Invalid Token');
    $msgs = array();
    $cleardata = new DOCMAN_Cleardata($cid);
    $cleardata->clear();
    $rows =& $cleardata->getList();
    foreach ($rows as $row) {
        $msgs[] = $row->msg;
    }
    mosRedirect('index2.php?option=com_docman&section=cleardata', implode(' | ', $msgs));
}
 function save()
 {
     global $my, $mainframe, $database, $option, $priTask, $subTask;
     global $WBG_CONFIG, $wbGalleryDB_cat, $wbGallery_admin;
     // Check Writeable
     if (!is_writable($wbGallery_admin . '/config.php')) {
         echo "<script> alert('Permission Denied for config.php'); window.history.go(-1); </script>\n";
         exit;
     }
     // Save Old Configuration
     $bakFile = $wbGallery_admin . '/config_bak.' . date('Y-m-d') . '.php';
     if (!file_exists($bakFile) && !copy($wbGallery_admin . '/config.php', $bakFile)) {
         echo "<script> alert('Failed to Create Backup Copy of Configuration {$bakFile}'); window.history.go(-1); </script>\n";
         exit;
     }
     // Process Configuration Values
     $exLines = array();
     $exLines[] = '<?php' . "\n";
     $exLines[] = 'defined(\'_VALID_MOS\') or die(\'Restricted access\');' . "\n";
     $exLines[] = '$WBG_CONFIG = new stdClass();';
     $wbgConfig = mosGetParam($_REQUEST, 'wbgconf');
     // Prepare Output & Count Active Types
     $img_types = 0;
     foreach ($wbgConfig as $k => $v) {
         $exLines[] = '$WBG_CONFIG->' . $k . " = '" . addslashes($v) . "';";
         if (preg_match('/^save_/', $k) && (int) $v) {
             $img_types++;
         }
     }
     // Write New Configuration
     $fp = fopen($wbGallery_admin . '/config.php', 'w');
     fwrite($fp, join("\n", $exLines));
     fclose($fp);
     // If No Types Active, Flag Error and Force Return...
     if (!$img_types) {
         $subTask = 'error';
         $errorMsg = 'No Image Types where set to Active!\\nAt Least (1) Type is Required, or else nothing will be stored when you try and add images!';
     }
     // Redirect
     switch ($subTask) {
         case 'save':
             mosRedirect('index2.php?option=' . $option, 'Configuration Saved Successfully');
             break;
         case 'error':
             echo "<script> alert('Error: {$errorMsg}'); document.location='index2.php?option={$option}&task=setup'; </script>\n";
             exit;
             break;
         default:
             mosRedirect('index2.php?option=' . $option . '&task=setup', 'Configuration Saved Successfully');
             break;
     }
 }
Example #7
0
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>';
    }
}
Example #8
0
 function redirect($link, $message = '')
 {
     global $mainframe;
     if (compa::joom10()) {
         if (!preg_match("/index2/", $link) and function_exists('sefRelToAbs') and $GLOBALS[ACA . 'use_sef']) {
             $link = sefRelToAbs($link);
         }
         mosRedirect($link, $message);
         exit;
     } else {
         $mainframe->redirect($link, $message);
         exit;
     }
 }
Example #9
0
function orderModule($uid, $inc, $option, $client = 'admin')
{
    global $database;
    $row = new mosModule($database);
    $row->load((int) $uid);
    if ($client == 'admin') {
        $where = "client_id = 1";
    } else {
        $where = "client_id = 0";
    }
    $row->move($inc, "position = " . $database->Quote($row->position) . " AND ( {$where} )");
    mosCache::cleanCache('com_content');
    $redirect = mosGetParam($_REQUEST, 'redirect', 'index2.php?option=' . $option . '&client=' . $client);
    mosRedirect($redirect);
}
Example #10
0
function rename_item($dir, $item)
{
    // rename directory or file
    if (($GLOBALS["permissions"] & 01) != 01) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") {
        $newitemname = $GLOBALS['__POST']["newitemname"];
        $newitemname = trim(basename(stripslashes($newitemname)));
        if ($newitemname == '') {
            show_error($GLOBALS["error_msg"]["miscnoname"]);
        }
        if (!jx_isFTPMode()) {
            $abs_old = get_abs_item($dir, $item);
            $abs_new = get_abs_item($dir, $newitemname);
        } else {
            $abs_old = get_item_info($dir, $item);
            $abs_new = get_item_info($dir, $newitemname);
        }
        if (@$GLOBALS['jx_File']->file_exists($abs_new)) {
            show_error($newitemname . ": " . $GLOBALS["error_msg"]["itemdoesexist"]);
        }
        $perms_old = $GLOBALS['jx_File']->fileperms($abs_old);
        $ok = $GLOBALS['jx_File']->rename(get_abs_item($dir, $item), get_abs_item($dir, $newitemname));
        if (jx_isFTPMode()) {
            $abs_new = get_item_info($dir, $newitemname);
        }
        $GLOBALS['jx_File']->chmod($abs_new, $perms_old);
        if ($ok === false || PEAR::isError($ok)) {
            show_error('Could not rename ' . $item . ' to ' . $newitemname);
        }
        $msg = sprintf($GLOBALS['messages']['success_rename_file'], $item, $newitemname);
        mosRedirect(make_link("list", $dir, null), $msg);
    }
    show_header($GLOBALS['messages']['rename_file']);
    // Form
    echo '<br /><form method="post" action="';
    echo make_link("rename", $dir, $item) . "\">\n";
    echo "<input type=\"hidden\" name=\"confirm\" value=\"true\" />\n";
    echo "<input type=\"hidden\" name=\"item\" value=\"" . stripslashes($GLOBALS['__GET']["item"]) . "\" />\n";
    // Submit / Cancel
    echo "<table>\n<tr><tr><td colspan=\"2\">\n";
    echo "<label for=\"newitemname\">" . $GLOBALS["messages"]["newname"] . ":</label>&nbsp;&nbsp;&nbsp;<input name=\"newitemname\" id=\"newitemname\" type=\"text\" size=\"60\" value=\"" . stripslashes($_GET['item']) . "\" /><br /><br /><br /></td></tr>\n";
    echo "<tr><tr><td>\n<input type=\"submit\" value=\"" . $GLOBALS["messages"]["btnchange"];
    echo "\"></td>\n<td><input type=\"button\" value=\"" . $GLOBALS["messages"]["btncancel"];
    echo "\" onclick=\"javascript:location='" . make_link("list", $dir, NULL) . "';\">\n</td></tr></form></table><br />\n";
}
Example #11
0
function pollAddVote($uid)
{
    global $database, $mosConfig_offset, $Itemid;
    $redirect = 1;
    $sessionCookieName = md5('site' . $GLOBALS['mosConfig_live_site']);
    $sessioncookie = mosGetParam($_REQUEST, $sessionCookieName, '');
    if (!$sessioncookie) {
        echo '<h3>' . T_('Cookies must be enabled!') . '"</h3>';
        echo '<input class="button" type="button" value="' . T_('Continue') . '" onClick="window.history.go(-1);">';
        return;
    }
    $poll = new mosPoll($database);
    if (!$poll->load($uid)) {
        echo '<h3>' . T_('You are not authorized to view this resource.') . '</h3>';
        echo '<input class="button" type="button" value="' . T_('Continue') . '" onClick="window.history.go(-1);">';
        return;
    }
    $cookiename = "voted{$poll->id}";
    $voted = mosGetParam($_COOKIE, $cookiename, '0');
    if ($voted) {
        echo "<h3>" . T_('You already voted for this poll today!') . "</h3>";
        echo "<input class=\"button\" type=\"button\" value=\"" . T_('Continue') . "\" onClick=\"window.history.go(-1);\">";
        return;
    }
    $voteid = mosGetParam($_POST, 'voteid', 0);
    if (!$voteid) {
        echo "<h3>" . T_('No selection has been made, please try again') . "</h3>";
        echo '<input class="button" type="button" value="' . T_('Continue') . '" onClick="window.history.go(-1);">';
        return;
    }
    setcookie($cookiename, '1', time() + $poll->lag);
    $database->setQuery("UPDATE #__poll_data SET hits=hits + 1" . "\n WHERE pollid='{$poll->id}' AND id='{$voteid}'");
    $database->query();
    $database->setQuery("UPDATE #__polls SET voters=voters + 1" . "\n WHERE id='{$poll->id}'");
    $database->query();
    $now = date("Y-m-d G:i:s");
    $database->setQuery("INSERT INTO #__poll_date SET date='{$now}', vote_id='{$voteid}',\tpoll_id='{$poll->id}'");
    $database->query();
    if ($redirect) {
        mosRedirect(sefRelToAbs('index.php?option=com_poll&task=results&id=' . $uid), T_('Thanks for your vote!'));
    } else {
        echo '<h3>' . T_('Thanks for your vote!') . '</h3>';
        echo '<form action="" method="GET">';
        echo '<input class="button" type="button" value="' . T_('Results') . '" onClick="window.location=\'' . sefRelToAbs('index.php?option=com_poll&task=results&id=' . $uid) . '\'">';
        echo '</form>';
    }
}
Example #12
0
function sendMail()
{
    global $database, $my, $acl;
    global $mosConfig_sitename;
    global $mosConfig_mailfrom, $mosConfig_fromname;
    $mode = mosGetParam($_POST, 'mm_mode', 0);
    $subject = mosGetParam($_POST, 'mm_subject', '');
    $gou = mosGetParam($_POST, 'mm_group', NULL);
    $recurse = mosGetParam($_POST, 'mm_recurse', 'NO_RECURSE');
    $inc_blocked = mosGetParam($_POST, 'inc_blocked', 0);
    // pulls message inoformation either in text or html format
    if ($mode) {
        $message_body = $_POST['mm_message'];
    } else {
        // automatically removes html formatting
        $message_body = mosGetParam($_POST, 'mm_message', '');
    }
    $message_body = stripslashes($message_body);
    if (!$message_body || !$subject || $gou === null) {
        $msg = T_('Please fill in the form correctly');
        mosRedirect('index2.php?option=com_massmail&mosmsg=' . $msg);
    }
    // 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 FROM #__users WHERE id='{$my->id}'";
        $database->setQuery($query);
        $my->email = $database->loadResult();
        // Get all users email and group except for senders
        $query = "SELECT email FROM #__users" . "\n WHERE id != '{$my->id}'" . ($inc_blocked !== '0' ? " AND block = 0 " : '') . ($gou !== '0' ? " AND id IN (" . implode(',', $to['users']) . ")" : '');
        $database->setQuery($query);
        $rows = $database->loadObjectList();
        // Build e-mail message format
        $message_header = sprintf(T_("This is an email from '%s'\n\nMessage:\n"), $mosConfig_sitename);
        $message = $message_header . $message_body;
        $subject = $mosConfig_sitename . ' / ' . stripslashes($subject);
        //Send email
        foreach ($rows as $row) {
            mosMail($mosConfig_mailfrom, $mosConfig_fromname, $row->email, $subject, $message, $mode);
        }
    }
    $msg = sprintf(Tn_('E-mail sent to %d user.', 'E-mail sent to %d users.', count($rows)), count($rows));
    mosRedirect('index2.php?option=com_massmail', $msg);
}
Example #13
0
   /**
	* edit categories
	*/
	function editgroups($cid)
	{
		global $option;
  		$db =& JFactory::getDBO();
		$my = & JFactory::getUser();

		$row = new hwdvids_group( $db );
		$row->load( $cid );

		// fail if checked out not by 'me'
		if ($row->isCheckedOut( $my->id )) {
			//BUMP needs change for multilanguage support
			mosRedirect( 'index.php?option='.$option.'&task=categories', 'The categorie $row->catname is currently being edited by another administrator.' );
		}

		$db->SetQuery("SELECT * FROM #__hwdvidsgroups"
							. "\nWHERE id = $cid");
		$db->loadObject($row);

		if ($cid) {
			$row->checkout( $my->id );
		} else {
			$row->published = 1;
		}

		$query        = "SELECT m.*, u.name, u.username"
				      . " FROM #__hwdvidsgroup_membership AS m"
				      . " LEFT JOIN #__users AS u ON u.id = m.memberid"
		              . " WHERE m.groupid = ".$row->id;

		$db->SetQuery($query);
		$groupMembers = $db->loadObjectList();

		$query      = "SELECT v.*, video.title"
				    . " FROM #__hwdvidsvideos AS video"
				    . " LEFT JOIN #__hwdvidsgroup_videos AS v ON v.videoid = video.id"
		            . " WHERE v.groupid = ".$row->id;


		$db->SetQuery($query);
		$groupVideos = $db->loadObjectList();


		hwdvids_HTML::editgroups($row, $groupMembers, $groupVideos);
	}
Example #14
0
function removeLog($cid)
{
    DOCMAN_token::check() or die('Invalid Token');
    global $database, $_DMUSER;
    $log = new mosDMLog($database);
    $rows = $log->loadRows($cid);
    // For log mambots
    if ($log->remove($cid)) {
        if ($rows) {
            $logbot = new DOCMAN_mambot('onLogDelete');
            $logbot->setParm('user', $_DMUSER);
            $logbot->copyParm('process', 'delete log');
            $logbot->setParm('rows', $rows);
            $logbot->trigger();
            // Delete the logs
        }
        mosRedirect("index2.php?option=com_docman&section=logs");
    }
}
Example #15
0
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);
    }
}
Example #16
0
function sendNewPass($option)
{
    global $database, $Itemid;
    global $mosConfig_live_site, $mosConfig_sitename, $mosConfig_fromname;
    $_live_site = $mosConfig_live_site;
    $_sitename = $mosConfig_sitename;
    // ensure no malicous sql gets past
    $checkusername = trim(mosGetParam($_POST, 'checkusername', ''));
    $checkusername = $database->getEscaped($checkusername);
    $confirmEmail = trim(mosGetParam($_POST, 'confirmEmail', ''));
    $confirmEmail = $database->getEscaped($confirmEmail);
    $database->setQuery("SELECT id FROM #__users" . "\nWHERE username='******' AND email='{$confirmEmail}'");
    if (!($user_id = $database->loadResult()) || !$checkusername || !$confirmEmail) {
        mosRedirect("index.php?option={$option}&task=lostPassword&mosmsg=" . T_('Sorry, no corresponding user was found.  Please make sure you entered a valid username and a valid email address.  Both are required.'));
    }
    $database->setQuery("SELECT name, email FROM #__users" . "\n WHERE usertype='super administrator'");
    $rows = $database->loadObjectList();
    foreach ($rows as $row) {
        $adminName = $row->name;
        $adminEmail = $row->email;
    }
    $rawpass = mosMakePassword();
    $message = sprintf(T_("The user account %s has this email associated with it.\n\nA web user from %s has just requested that a new password be sent.\n\n\nYour New Password is: %s\n\n\nIf you didn't ask for this, don't worry. You are seeing this message, not them. \nIf this was an error just login with your new password and then change your password to what you would like it to be."), $checkusername, $mosConfig_live_site, $rawpass);
    #eval ("\$message = \"$message\";");
    $subject = sprintf(T_('%s :: New password for - %s'), $_sitename, $checkusername);
    #eval ("\$subject = \"$subject\";");
    mosMail($mosConfig_mailfrom, $mosConfig_fromname, $confirmEmail, $subject, $message);
    $newpass = md5($rawpass);
    $sql = "UPDATE #__users SET password='******' WHERE id='{$user_id}'";
    $database->setQuery($sql);
    if (!$database->query()) {
        die("SQL error" . $database->stderr(true));
    }
    $loginfo = new mosLoginDetails($checkusername, $rawpass);
    $mambothandler =& mosMambotHandler::getInstance();
    $mambothandler->loadBotGroup('authenticator');
    $mambothandler->trigger('userChange', array($loginfo));
    mosRedirect("index.php?Itemid={$Itemid}&mosmsg=" . T_('New User Password created and sent!'));
}
Example #17
0
 function saveMenu($option)
 {
     global $database;
     $params = mosGetParam($_POST, 'params', '');
     $secids = mosGetParam($_POST, 'secid', array());
     $secid = implode(',', $secids);
     $params[sectionid] = $secid;
     if (is_array($params)) {
         $txt = array();
         foreach ($params as $k => $v) {
             $txt[] = "{$k}={$v}";
         }
         $_POST['params'] = implode("\n", $txt);
     }
     $row = new mosMenu($database);
     if (!$row->bind($_POST)) {
         echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
         exit;
     }
     if (count($secids) == 1 && $secids[0] != "") {
         $row->link = str_replace("id=0", "id=" . $secids[0], $row->link);
         $row->componentid = $secids[0];
     }
     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;
     }
     $row->checkin();
     $row->updateOrder("menutype='{$row->menutype}' AND parent='{$row->parent}'");
     mosRedirect('index2.php?option=' . $option . '&menutype=' . $row->menutype);
 }
Example #18
0
/**
* Restores items selected to normal - restores to an unpublished state
*/
function restoreTrash($cid, $option)
{
    global $database;
    josSpoofCheck();
    $type = mosGetParam($_POST, 'type', array(0));
    $total = count($cid);
    // restores to an unpublished state
    $state = 0;
    $ordering = 9999;
    if ($type == 'content') {
        // query to restore content items
        mosArrayToInts($cid);
        $cids = 'id=' . implode(' OR id=', $cid);
        $query = "UPDATE #__content" . "\n SET state = " . (int) $state . ", ordering = " . (int) $ordering . "\n WHERE ( {$cids} )";
        $database->setQuery($query);
        if (!$database->query()) {
            echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
            exit;
        }
    } else {
        if ($type == 'menu') {
            sort($cid);
            foreach ($cid as $id) {
                $check = 1;
                $row = new mosMenu($database);
                $row->load($id);
                // check if menu item is a child item
                if ($row->parent != 0) {
                    $query = "SELECT id" . "\n FROM #__menu" . "\n WHERE id = " . (int) $row->parent . "\n AND ( published = 0 OR published = 1 )";
                    $database->setQuery($query);
                    $check = $database->loadResult();
                    if (!$check) {
                        // if menu items parent is not found that are published/unpublished make it a root menu item
                        $query = "UPDATE #__menu" . "\n SET parent = 0, published = " . (int) $state . ", ordering = 9999" . "\n WHERE id = " . (int) $id;
                    }
                }
                if ($check) {
                    // query to restore menu items
                    $query = "UPDATE #__menu" . "\n SET published = " . (int) $state . ", ordering = 9999" . "\n WHERE id = " . (int) $id;
                }
                $database->setQuery($query);
                if (!$database->query()) {
                    echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
                    exit;
                }
            }
        }
    }
    $msg = $total . " Iten(s) restaurados com sucesso!";
    mosRedirect("index2.php?option={$option}&mosmsg=" . $msg . "");
}
Example #19
0
<?php

/**
* @version $Id: template.php,v 1.1 2004/10/13 08:16:15 dappa Exp $
* @package Mambo_4.5.1
* @copyright (C) 2000 - 2004 Miro International Pty Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* Mambo is Free Software
* @subpackage Installer
*/
/** ensure this file is being included by a parent file */
defined('_VALID_MOS') or die('Direct Access to this location is not allowed.');
// ensure user has access to this function
if (!$acl->acl_check('administration', 'install', 'users', $my->usertype, $element . 's', 'all')) {
    mosRedirect('index2.php', _NOT_AUTH);
}
$client = mosGetParam($_REQUEST, 'client', '');
$userfile = mosGetParam($_REQUEST, 'userfile', dirname(__FILE__));
$userfile = mosPathName($userfile);
HTML_installer::showInstallForm($adminLanguage->A_INSTALL_TEMPL_INSTALL . ($client == 'admin' ? $adminLanguage->A_INSTALL_TEMPL_ADMIN_TEMPL : $adminLanguage->A_INSTALL_TEMPL_SITE_TEMPL), $option, 'template', $client, $userfile, '<a href="index2.php?option=com_templates&client=' . $client . '">' . $adminLanguage->A_INSTALL_TEMPL_BACKTTO_TEMPL . '</a>');
?>
<table class="content">
<?php 
writableCell('media');
writableCell('administrator/templates');
writableCell('templates');
writableCell('images/stories');
?>
</table>
Example #20
0
		//-->
		</script>
		<?php 
        }
        if ($return && !(strpos($return, 'com_registration') || strpos($return, 'com_login'))) {
            // checks for the presence of a return url
            // and ensures that this url is not the registration or logout pages
            mosRedirect($return);
        } else {
            mosRedirect($mosConfig_live_site . '/index.php');
        }
    } else {
        if ($option == 'cookiecheck') {
            // No cookie was set upon login. If it is set now, redirect to the given page. Otherwise, show error message.
            if (isset($_COOKIE[mosMainFrame::sessionCookieName()])) {
                mosRedirect($return);
            } else {
                mosErrorAlert(_ALERT_ENABLED);
            }
        }
    }
}
// detect first visit
$mainframe->detect();
// set for overlib check
$mainframe->set('loadOverlib', false);
$gid = intval($my->gid);
// gets template for page
$cur_template = $mainframe->getTemplate();
/** temp fix - this feature is currently disabled */
/** @global A places to store information from processing of the component */
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);
}
Example #22
0
 * @package jTips
 * 
 * Description: Delete the current import file
 */
jTipsSpoofCheck();
global $jLang, $mosConfig_absolute_path;
$file = $mosConfig_absolute_path . '/administrator/components/com_jtips/import.csv';
if (isJoomla15()) {
    jimport('joomla.filesystem.file');
    if (JFile::exists($file)) {
        if (JFile::delete($file)) {
            $message = $jLang['_ADMIN_FILE_DELETED'];
        } else {
            $message = $jLang['_ADMIN_FILE_DELETE_FAILED'];
        }
    } else {
        $message = $jLang['_ADMIN_FILE_DELETE_NOFILE'];
    }
} else {
    if (file_exists($file)) {
        if (unlink($file)) {
            $message = $jLang['_ADMIN_FILE_DELETED'];
        } else {
            $message = $jLang['_ADMIN_FILE_DELETE_FAILED'];
        }
    } else {
        $message = $jLang['_ADMIN_FILE_DELETE_NOFILE'];
    }
}
mosRedirect('index2.php?option=com_jtips&task=list&module=Import', $message);
Example #23
0
 function returnTo($task, $msg = '', $gid = '', $params = null)
 {
     $link = DOCMAN_Utils::_rawLink($task, $gid, $params);
     mosRedirect($link, $msg);
 }
Example #24
0
/**
*/
function savePositions($option)
{
    global $database;
    $positions = mosGetParam($_POST, 'position', array());
    $descriptions = mosGetParam($_POST, 'description', array());
    $query = 'DELETE FROM #__template_positions';
    $database->setQuery($query);
    $database->query();
    foreach ($positions as $id => $position) {
        $position = trim($database->getEscaped($position));
        $description = mosGetParam($descriptions, $id, '');
        if ($position != '') {
            $id = intval($id);
            $query = "INSERT INTO #__template_positions" . "\nVALUES ({$id},'{$position}','{$description}')";
            $database->setQuery($query);
            $database->query();
        }
    }
    mosRedirect('index2.php?option=' . $option . '&task=positions', T_('Positions saved'));
}
Example #25
0
/**
* Save the item(s) to the menu selected
*/
function copyMenuSave($option, $cid, $menu, $menutype)
{
    global $database, $my;
    $total = count($cid);
    $copy = new mosMenu($database);
    $original = new mosMenu($database);
    foreach ($cid as $id) {
        $original->load($id);
        $copy = $original;
        $copy->id = NULL;
        $copy->ordering = '9999';
        $copy->menutype = $menu;
        if (!$copy->store()) {
            echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
            exit;
        }
        $copy->updateOrder("menutype='" . $copy->menutype . "' AND parent='" . $copy->parent . "'");
    }
    $msg = $total . $adminLanguage->A_COMP_MENUS_COPIED_TO . $menu;
    mosRedirect('index2.php?option=' . $option . '&menutype=' . $menutype . '&mosmsg=' . $msg);
}
Example #26
0
$GLOBALS['jx_File'] = new jx_File();
if (jx_isFTPMode()) {
    // Try to connect to the FTP server.    	HOST,   PORT, TIMEOUT
    $ftp_host = mosGetParam($_POST, 'ftp_host', 'localhost:21');
    $url = @parse_url('ftp://' . $ftp_host);
    $port = empty($url['port']) ? 21 : $url['port'];
    $ftp = new Net_FTP($url['host'], $port, 20);
    /** @global Net_FTP $GLOBALS['FTPCONNECTION'] */
    $GLOBALS['FTPCONNECTION'] = new Net_FTP($url['host'], $port, 20);
    $res = $GLOBALS['FTPCONNECTION']->connect();
    if (PEAR::isError($res)) {
        echo $res->getMessage();
        $GLOBALS['file_mode'] = $_SESSION['file_mode'] = 'file';
    } else {
        if (empty($_SESSION['ftp_login']) && empty($_SESSION['ftp_pass'])) {
            mosRedirect('index2.php?option=com_joomlaxplorer&action=ftp_authentication&file_mode=file');
        }
        $login_res = $GLOBALS['FTPCONNECTION']->login($_SESSION['ftp_login'], $_SESSION['ftp_pass']);
        if (PEAR::isError($res)) {
            echo $login_res->getMessage();
            $GLOBALS['file_mode'] = $_SESSION['file_mode'] = 'file';
        }
    }
}
//------------------------------------------------------------------------------
if ($GLOBALS["require_login"]) {
    // LOGIN
    require _QUIXPLORER_PATH . "/include/login.php";
    if ($GLOBALS["action"] == "logout") {
        logout();
    } else {
Example #27
0
/**
* Utility function redirect the browser location to another url
*
* Can optionally provide a message.
* @param string The URL to redirect to
* @param string A Message to display to the user
*/
function vmRedirect($url, $msg = '')
{
    if (function_exists('mosRedirect')) {
        mosRedirect($url, $msg);
    } elseif (vmIsJoomla('1.5', '>=')) {
        global $mainframe;
        $mainframe->redirect($url, $msg);
    } else {
        global $mainframe;
        // specific filters
        $iFilter = vmInputFilter::getInstance();
        $url = $iFilter->process($url);
        if (!empty($msg)) {
            $msg = $iFilter->process($msg);
        }
        // Strip out any line breaks and throw away the rest
        $url = preg_split("/[\r\n]/", $url);
        $url = $url[0];
        if ($iFilter->badAttributeValue(array('href', $url))) {
            $url = $GLOBALS['mosConfig_live_site'];
        }
        if (trim($msg)) {
            if (strpos($url, '?')) {
                $url .= '&mosmsg=' . urlencode($msg);
            } else {
                $url .= '?mosmsg=' . urlencode($msg);
            }
        }
        if (headers_sent()) {
            echo '<script type="text/javascript">document.location.href=\'' . $url . '\';</script>';
        } else {
            @ob_end_clean();
            // clear output buffer
            header('HTTP/1.1 301 Moved Permanently');
            header("Location: " . $url);
        }
        $GLOBALS['vm_mainframe']->close(true);
    }
}
Example #28
0
/**
* changes the access level of a record
* @param integer The increment to reorder by
*/
function accessMenu($uid, $access, $option, $client)
{
    global $database;
    switch ($access) {
        case 'accesspublic':
            $access = 0;
            break;
        case 'accessregistered':
            $access = 1;
            break;
        case 'accessspecial':
            $access = 2;
            break;
    }
    $row = new mosMambot($database);
    $row->load($uid);
    $row->access = $access;
    if (!$row->check()) {
        return $row->getError();
    }
    if (!$row->store()) {
        return $row->getError();
    }
    mosRedirect('index2.php?option=' . $option);
}
Example #29
0
File: index.php Project: cwcw/cms
        if ($message) {
            ?>
		<script> 
		<!--//
		alert( "<?php 
            echo _LOGOUT_SUCCESS;
            ?>
" ); 
		//-->
		</script>
		<?php 
        }
        if ($return) {
            mosRedirect($return);
        } else {
            mosRedirect('index.php');
        }
    }
}
/** get the information about the current user from the sessions table */
$my = $mainframe->getUser();
/** detect first visit */
$mainframe->detect();
$gid = intval($my->gid);
// gets template for page
$cur_template = $mainframe->getTemplate();
/** temp fix - this feature is currently disabled */
/** @global A places to store information from processing of the component */
$_MOS_OPTION = array();
// precapture the output of the component
require_once $mosConfig_absolute_path . '/editor/editor.php';
Example #30
0
function ftp_logout()
{
    unset($_SESSION['ftp_login']);
    unset($_SESSION['ftp_pass']);
    unset($_SESSION['ftp_host']);
    session_write_close();
    mosRedirect('index2.php?option=com_joomlaxplorer&file_mode=file');
}