function warnAdmin()
 {
     global $adminEmail, $mambelfishWarnedAdmin;
     $privateWarning = false;
     if (!$mambelfishWarnedAdmin) {
         $bt = debug_backtrace();
         if (count($bt) >= 2) {
             $subject = "Deprecated use of Mambelfish Translation";
             $content = "Deprecated use of Mambelfish. Request URL : " . $_SERVER['REQUEST_URI'] . "\n\n";
             $content .= "Please contact the author of this component/module/mambot with the details in this message.\n\n";
             $content .= "In the meantime the following function reference can be commented out and translation should not be affected.\n";
             $content .= "File : " . basename(dirname($bt[1]["file"])) . "\\" . basename($bt[1]["file"]) . "\n";
             $content .= "Line : " . $bt[1]["line"] . "\n";
             $content .= "Function : " . $bt[1]["function"] . "\n\n";
             if ($privateWarning) {
                 global $my;
                 $db =& JFactory::getDBO();
                 require_once mosMainFrame::getBasePath() . '/components/com_messages/messages.class.php';
                 $query = "SELECT id" . "\n FROM #__users" . "\n WHERE sendEmail = 1";
                 $db->setQuery($query);
                 $users = $db->loadResultArray(false);
                 foreach ($users as $user_id) {
                     $msg = new mosMessage($db);
                     // send message from admin
                     $msg->send($user_id, $user_id, $subject, $content);
                 }
             } else {
                 $content = str_replace("\n", "<br/>", $content);
                 echo "{$content}";
             }
         }
     }
     $mambelfishWarnedAdmin = true;
 }
Exemple #2
0
/**
* Displays the capture output of the main element
*/
function mosMainBody()
{
    global $mosConfig_live_site;
    // message passed via the url
    $mosmsg = stripslashes(strval(mosGetParam($_REQUEST, 'mosmsg', '')));
    $popMessages = false;
    // Browser Check
    $browserCheck = 0;
    if (isset($_SERVER['HTTP_USER_AGENT']) && isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], $mosConfig_live_site) !== false) {
        $browserCheck = 1;
    }
    // Session Check
    $sessionCheck = 0;
    // Session Cookie `name`
    $sessionCookieName = mosMainFrame::sessionCookieName();
    // Get Session Cookie `value`
    $sessioncookie = mosGetParam($_COOKIE, $sessionCookieName, null);
    if (strlen($sessioncookie) == 32 || $sessioncookie == '-') {
        $sessionCheck = 1;
    }
    // limit mosmsg to 150 characters
    if (strlen($mosmsg) > 150) {
        $mosmsg = substr($mosmsg, 0, 150);
    }
    // mosmsg outputed within html
    if ($mosmsg && !$popMessages && $browserCheck && $sessionCheck) {
        echo "\n<div class=\"message\">{$mosmsg}</div>";
    }
    echo $GLOBALS['_MOS_OPTION']['buffer'];
    // mosmsg outputed in JS Popup
    if ($mosmsg && $popMessages && $browserCheck && $sessionCheck) {
        echo "\n<script language=\"javascript\">alert('" . addslashes($mosmsg) . "');</script>";
    }
}
Exemple #3
0
 function authPlugin()
 {
     $my = mamboCore::get('currentUser');
     $this->usertype = $my->usertype;
     $this->username = $my->username;
     $this->grp = $my->gid;
     $this->mainframe = mosMainFrame::getInstance();
 }
 function getSessionToken()
 {
     // Session Cookie `name`
     $sessionCookieName = mosMainFrame::sessionCookieName();
     // Get Session Cookie `value`
     $sessioncookie = zmgGetParam($_COOKIE, $sessionCookieName, null);
     // Session ID / `value`
     return mosMainFrame::sessionCookieValue($sessioncookie);
 }
 function setMetaData()
 {
     $mainframe = mosMainFrame::getInstance();
     $mainframe->prependMetaTag('description', strip_tags($this->name));
     if ($this->keywords) {
         $mainframe->prependMetaTag('keywords', $this->keywords);
     } else {
         $mainframe->prependMetaTag('keywords', $this->name);
     }
 }
Exemple #6
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>';
    }
}
Exemple #7
0
function SERVICE_CMSCSS_mambo()
{
    global $mosConfig_host, $mosConfig_user, $mosConfig_password, $mosConfig_db, $mosConfig_dbprefix, $include_path, $thename, $bgcolor1, $bgcolor2, $css, $row_colors, $jz_MenuItem, $jz_MenuItemHover, $jz_MenuItemLeft, $jz_MainItemHover, $jz_MenuSplit;
    $option = trim(strtolower(mosGetParam($_REQUEST, 'option')));
    $Itemid = intval(mosGetParam($_REQUEST, 'Itemid', null));
    $database = new database($mosConfig_host, $mosConfig_user, $mosConfig_password, $mosConfig_db, $mosConfig_dbprefix);
    $mainframe = new mosMainFrame($database, $option, '.');
    $mainframe->initSession();
    $thename = $mainframe->getTemplate();
    // Now let's set the style sheet for CMS stuff
    $_SESSION['cms-style'] = "templates/" . $thename . "/css/template_css.css";
    $_SESSION['cms-theme-data'] = urlencode($bgcolor1 . "|" . $bgcolor2);
    $row_colors = array('sectiontableentry2', 'tabheading');
    $jz_MenuItemHover = "tabheading";
    $jz_MenuItem = "sectiontableentry2";
    $jz_MenuItemLeft = "jzMenuItemLeft";
    $jz_MenuSplit = "jzMenuSplit";
    $jz_MainItemHover = "jzMainItemHover";
    // Now let's set the CSS
    $css = $include_path . "style/cms-theme/default.php";
    return $css;
}
 /**
  * Editmon object contructor.
  *
  * @return editmon
  * @access public
  */
 function editmon()
 {
     global $mosConfig_lifetime, $mainframe, $_SESSION;
     $this->_lifetime = $mosConfig_lifetime;
     if (is_callable(array('mosMainframe', 'sessionCookieName'))) {
         // Session Cookie `name`
         $sessionCookieName = mosMainFrame::sessionCookieName();
         // Get Session Cookie `value`
         $sessioncookie = mosGetParam($_COOKIE, $sessionCookieName, null);
         // Session ID / `value`
         $sessionValueCheck = mosMainFrame::sessionCookieValue($sessioncookie);
         $this->_session_id = $sessionValueCheck;
     } else {
         if (isset($mainframe) && is_object($mainframe->_session)) {
             $this->_session_id = $mainframe->_session->session_id;
         } else {
             if (isset($_COOKIE['sessioncookie'])) {
                 $sessioncookie = $_COOKIE['sessioncookie'];
                 $this->_session_id = md5($sessioncookie . $_SERVER['REMOTE_ADDR']);
             }
         }
     }
 }
Exemple #9
0
    /**
     * Writes Print icon
     */
    function PrintIcon(&$row, &$params, $hide_js, $link, $status = NULL)
    {
        if ($params->get('print') && !$hide_js) {
            // use default settings if none declared
            if (!$status) {
                $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no';
            }
            // checks template image directory for image, if non found default are loaded
            if ($params->get('icons')) {
                $mainframe =& mosMainFrame::getInstance();
                $image = $mainframe->ImageCheck('printButton.png', '/images/M_images/', NULL, NULL, T_('Print'));
            } else {
                $image = _ICON_SEP . '&nbsp;' . T_('Print') . '&nbsp;' . _ICON_SEP;
            }
            if ($params->get('popup') && !$hide_js) {
                // Print Preview button - used when viewing page
                ?>
				<td align="right" class="buttonheading">
				<a href="#" onclick="javascript:window.print(); return false" title="<?php 
                echo T_('Print');
                ?>
">
				<?php 
                echo $image;
                ?>
				</a>
				</td>
				<?php 
            } else {
                // Print Button - used in pop-up window
                ?>
				<td align="right" class="buttonheading">
				<a href="javascript:void window.open('<?php 
                echo $link;
                ?>
', 'win2', '<?php 
                echo $status;
                ?>
');" title="<?php 
                echo T_('Print');
                ?>
">
				<?php 
                echo $image;
                ?>
				</a>
				</td>
				<?php 
            }
        }
    }
Exemple #10
0
 function groupMarking(&$params)
 {
     switch ($params->get('contact_icons')) {
         case 1:
             // text
             $params->set('marker_address', T_('Address: '));
             $params->set('marker_email', T_('Email: '));
             $params->set('marker_telephone', T_('Telephone: '));
             $params->set('marker_fax', T_('Fax: '));
             $params->set('marker_misc', T_('Information: '));
             $params->set('column_width', '100px');
             break;
         case 2:
             // none
             $params->set('marker_address', '');
             $params->set('marker_email', '');
             $params->set('marker_telephone', '');
             $params->set('marker_fax', '');
             $params->set('marker_misc', '');
             $params->set('column_width', '0px');
             break;
         default:
             // icons
             $mainframe = mosMainFrame::getInstance();
             $image1 = $mainframe->ImageCheck('con_address.png', '/images/M_images/', $params->get('icon_address'));
             $image2 = $mainframe->ImageCheck('emailButton.png', '/images/M_images/', $params->get('icon_email'));
             $image3 = $mainframe->ImageCheck('con_tel.png', '/images/M_images/', $params->get('icon_telephone'));
             $image4 = $mainframe->ImageCheck('con_fax.png', '/images/M_images/', $params->get('icon_fax'));
             $image5 = $mainframe->ImageCheck('con_info.png', '/images/M_images/', $params->get('icon_misc'));
             $params->set('marker_address', $image1);
             $params->set('marker_email', $image2);
             $params->set('marker_telephone', $image3);
             $params->set('marker_fax', $image4);
             $params->set('marker_misc', $image5);
             $params->set('column_width', '40px');
             break;
     }
 }
Exemple #11
0
/**
 * Check if user session exists. Adapted from Joomla original code
 */
function shLookupSession()
{
    global $mainframe;
    return false;
    // does not work in 1.5. Not needed anyway, as long as multilingual 303 redirect is not solved
    $database =& JFactory::getDBO();
    // initailize session variables
    $session = new mosSession($database);
    $option = strval(strtolower(JRequest::getVar('option')));
    $mainframe = new mosMainFrame($database, $option, '.');
    // purge expired sessions
    $session->purge('core');
    // can't purge as $mainframe is not initialized yet
    // Session Cookie `name`
    // WARNING : I am using the Hack from
    $sessionCookieName = mosMainFrame::sessionCookieName();
    // Get Session Cookie `value`
    $sessioncookie = strval(JRequest::getVar($sessionCookieName, null, 'COOKIE'));
    // Session ID / `value`
    $sessionValueCheck = mosMainFrame::sessionCookieValue($sessioncookie);
    // Check if existing session exists in db corresponding to Session cookie `value`
    // extra check added in 1.0.8 to test sessioncookie value is of correct length
    $ret = false;
    if ($sessioncookie && strlen($sessioncookie) == 32 && $sessioncookie != '-' && $session->load($sessionValueCheck)) {
        $ret = true;
    }
    unset($mainframe);
    return $ret;
}
Exemple #12
0
    function cancel($task = 'cancel', $alt = null)
    {
        if (is_null($alt)) {
            $alt = T_('Cancel');
        }
        $mainframe =& mosMainFrame::getInstance();
        $image = $mainframe->ImageCheck('cancel.png', '/administrator/images/', NULL, NULL, $alt, $task);
        $image2 = $mainframe->ImageCheck('cancel_f2.png', '/administrator/images/', NULL, NULL, $alt, $task, 0);
        ?>
		<td width="25" align="center">
		<a href="javascript:submitbutton('<?php 
        echo $task;
        ?>
');" onmouseout="MM_swapImgRestore();"  onmouseover="MM_swapImage('<?php 
        echo $task;
        ?>
','','<?php 
        echo $image2;
        ?>
',1);">
		<?php 
        echo $image;
        ?>
		</a>
		</td>
		<?php 
    }
Exemple #13
0
 /**
  * mosComponentAdminManager Class contructor 
  *
  * This constructor initiates all necessary members with values passed trought REQUEST
  * creates a new instance of the correct class and calls the task to do, finally 
  * restore the magic quotes to it initial state.
  *
  * @param string component name
  * @param string component version
  * @access private
  */
 function mosComponentAdminManager($component_name, $version)
 {
     mosComponentManager::mosComponentManager($component_name, $version);
     $this->act = mosGetParam($_REQUEST, 'act', $this->plugin_name);
     $this->task = mosGetParam($_REQUEST, 'task', 'list');
     $mainframe = mosMainFrame::getInstance();
     $default_limit = $mainframe->getUserStateFromRequest("viewlistlimit", 'limit', 20);
     $this->limit = intval(mosGetParam($_REQUEST, 'limit', $default_limit));
     $this->limitstart = mosGetParam($_REQUEST, 'limitstart', 0);
     $this->cfid = mosGetParam($_REQUEST, 'cfid', array(0));
     if (is_array($this->cfid)) {
         foreach ($this->cfid as $i => $id) {
             $this->cfid[$i] = intval($id);
         }
     }
     $this->order = mosGetParam($_REQUEST, 'order', array());
     if (is_array($this->cfid)) {
         $this->currid = intval($this->cfid[0]);
     } else {
         $this->currid = intval($this->cfid);
     }
     $name = $this->getAction();
     if (class_exists($name)) {
         $controller =& new $name($this);
         $task = $this->task . 'Task';
         if (is_callable(array(&$controller, 'getRequestData'))) {
             $controller->getRequestData();
         }
         if (is_callable(array(&$controller, $task))) {
             $controller->{$task}();
         } else {
             trigger_error(sprintf(T_('MOS error in %s: method %s not found in class %s'), $this->plugin_name, $task, $name));
         }
     } else {
         trigger_error(sprintf(T_('MOS error in %s: class not found %s'), $this->plugin_name, $name));
     }
     $this->restore_magic_quotes();
 }
Exemple #14
0
    parse_str($link, $temp);
    /** this is a patch, need to rework when globals are handled better */
    foreach ($temp as $k => $v) {
        $GLOBALS[$k] = $v;
        $_REQUEST[$k] = $v;
        if ($k == 'option') {
            $option = $v;
        }
    }
}
if (!$Itemid) {
    // when no Itemid give a default value
    $Itemid = 99999999;
}
// mainframe is an API workhorse, lots of 'core' interaction routines
$mainframe = new mosMainFrame($database, $option, '.');
$mainframe->initSession();
// trigger the onAfterStart events
$_MAMBOTS->trigger('onAfterStart');
// checking if we can find the Itemid thru the content
if ($option == 'com_content' && $Itemid === 0) {
    $id = intval(mosGetParam($_REQUEST, 'id', 0));
    $Itemid = $mainframe->getItemid($id);
}
/** do we have a valid Itemid yet?? */
if ($Itemid === 0) {
    /** Nope, just use the homepage then. */
    $query = "SELECT id" . "\n FROM #__menu" . "\n WHERE menutype = 'mainmenu'" . "\n AND published = 1" . "\n ORDER BY parent, ordering";
    $database->setQuery($query, 0, 1);
    $Itemid = $database->loadResult();
}
Exemple #15
0
    /**
     * Display Table of items
     */
    function showTable(&$params, &$rows, $catid, $tabclass)
    {
        global $mosConfig_live_site;
        // icon in table display
        if ($params->get('weblink_icons') != -1) {
            $mainframe =& mosMainFrame::getInstance();
            $img = $mainframe->ImageCheck('weblink.png', '/images/M_images/', $params->get('weblink_icons'));
        } else {
            $img = NULL;
        }
        ?>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<?php 
        if ($params->get('headings')) {
            ?>
			<tr>
				<?php 
            if ($img) {
                ?>
					<td class="sectiontableheader<?php 
                echo $params->get('pageclass_sfx');
                ?>
">&nbsp;

					</td>
					<?php 
            }
            ?>
				<td width="90%" height="20" class="sectiontableheader<?php 
            echo $params->get('pageclass_sfx');
            ?>
">
				<?php 
            echo T_('Web Link');
            ?>
				</td>
				<?php 
            if ($params->get('hits')) {
                ?>
					<td width="30px" height="20" class="sectiontableheader<?php 
                echo $params->get('pageclass_sfx');
                ?>
" align="right">
					<?php 
                echo T_('Hits');
                ?>
					</td>
					<?php 
            }
            ?>
			</tr>
			<?php 
        }
        $k = 0;
        foreach ($rows as $row) {
            $iparams =& new mosParameters($row->params);
            $link = sefRelToAbs('index.php?option=com_weblinks&task=view&catid=' . $catid . '&id=' . $row->id);
            $menuclass = 'category' . $params->get('pageclass_sfx');
            switch ($iparams->get('target')) {
                // cases are slightly different
                case 1:
                    // open in a new window
                    $txt = '<a href="' . $link . '" target="_blank" class="' . $menuclass . '">' . stripslashes($row->title) . '</a>';
                    break;
                case 2:
                    // open in a popup window
                    $txt = "<a href=\"#\" onclick=\"javascript: window.open('" . $link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"{$menuclass}\">" . stripslashes($row->title) . "</a>\n";
                    break;
                default:
                    // formerly case 2
                    // open in parent window
                    $txt = '<a href="' . $link . '" class="' . $menuclass . '">' . stripslashes($row->title) . '</a>';
                    break;
            }
            ?>
			<tr class="<?php 
            echo $tabclass[$k];
            ?>
">
				<?php 
            if ($img) {
                ?>
					<td width="100px" height="20" align="center">
					&nbsp;&nbsp;<?php 
                echo $img;
                ?>
&nbsp;&nbsp;
					</td>
					<?php 
            }
            ?>
				<td height="20">
				<?php 
            echo $txt;
            ?>
				<?php 
            if ($params->get('item_description')) {
                ?>
					<br />
					<?php 
                echo $row->description;
                ?>
					<?php 
            }
            ?>
				</td>
				<?php 
            if ($params->get('hits')) {
                ?>
					<td align="center">
					<?php 
                echo $row->hits;
                ?>
					</td>
					<?php 
            }
            ?>
			</tr>
			<?php 
            $k = 1 - $k;
        }
        ?>
		</table>
		<?php 
    }
function botEditorArea($name, $content, $hiddenField, $width, $height, $col, $row)
{
    global $my, $mosConfig_live_site, $database, $option, $_MAMBOTS, $mosConfig_absolute_path, $isInline, $bodyStyles, $template, $path_root;
    $gid = 20;
    $isInline = 0;
    $bodyStyles = "";
    $template = "";
    $content = str_replace("&lt;", "<", $content);
    $content = str_replace("&gt;", ">", $content);
    $content = str_replace("&amp;", "&", $content);
    $content = str_replace("&nbsp;", " ", $content);
    $content = str_replace("&quot;", "\"", $content);
    $mainframe = new mosMainFrame($database, $option, '.');
    $query = "SELECT id FROM #__mambots WHERE element = 'legacy.fckeditor' AND folder = 'editors'";
    $database->setQuery($query);
    $id = $database->loadResult();
    $mambot = new mosMambot($database);
    $mambot->load($id);
    $params =& new mosParameters($mambot->params);
    $toolbar = $params->get('toolbar', 'Advanced');
    $toolbar_ft = $params->get('toolbar_ft', 'Advanced');
    $content_css = $params->get('content_css', '1');
    $editor_css = $params->get('editor_css', '0');
    $content_css_custom = $params->get('content_css_custom', '');
    $text_direction = $params->get('text_direction', 'ltr');
    $newlines = $params->get('newlines', 'false');
    $skin = $params->get('skin', 'office2007');
    $image_path = $params->get('imagePath', '/images/stories/');
    $wwidth = $params->get('wwidth', '100%');
    $hheight = $params->get('hheight', '480');
    $formatSource = $params->get('FormatSource', 1);
    $add_stylesheet_path = $params->get('add_stylesheet_path', '');
    $add_stylesheet = $params->get('add_stylesheet', '');
    $bgcolor = $params->get('bgcolor', '#FFFFFF');
    $fontcolor = $params->def('fontcolor', '');
    $entermode = $params->def('entermode', 0);
    $shiftentermode = $params->def('shiftentermode', 1);
    $htmlentities = $params->def('htmlentities', 0);
    $crtlshiftentermode = $params->def('ctrlshiftentermode', 2);
    $includelatinentities = $params->def('includelatinentities', 0);
    $includegreekentities = $params->def('includegreekentities', 0);
    $numericentities = $params->def('numericentities', 0);
    $useRelativeURLPath = $params->def('UserRelativeFilePath', 1);
    $textAlign = $params->def('TextAlign', '');
    $showerrors = $params->def('showerrors', 1);
    $ForceSpellCheck = $params->def('ForceSpellCheck', 0);
    //set default view for toolabar
    $toolbar = $toolbar == 'Default' ? 'Advanced' : $toolbar;
    $toolbar_ft = $toolbar_ft == 'Default' ? 'Advanced' : $toolbar_ft;
    //set flag to see if Pspell should be enabled
    $enablePspell = function_exists("pspell_check") ? 1 : 0;
    //define path_root for relative path
    $path_root = '../';
    if (strpos($_SERVER['REQUEST_URI'], 'administrator')) {
        $logintime = mosGetParam($_SESSION, 'session_logintime', '');
        $session_id = md5($my->id . $my->username . $my->usertype . $logintime);
    } else {
        $query = 'select s.session_id from #__session s' . ' join #__users u on u.id = s.userid ' . ' where u.id =' . $my->id . ' and s.guest = 0 and u.gid > 18 ';
        $database->setQuery($query);
        $session_id = $database->loadResult();
        //set toolbar to compact mode
        $toolbar = $toolbar_ft;
        $path_root = '';
    }
    //check to see if we have to change the install chmod settings
    changeFCKChmod($path_root);
    /* Need to check to see  session recorded already created */
    $ip = md5($_SERVER['REMOTE_ADDR']);
    $query = 'select session_id from #__session where session_id =\'' . $ip . '\'';
    $database->setQuery($query);
    $ip_recorded = $database->loadResult();
    if (!isset($ip_recorded)) {
        $query = 'insert into #__session(username,time,session_id,gid) values(\'' . $session_id . '\',\'' . (time() + 7200) . '\',\'' . $ip . '\',0)';
    } else {
        $query = 'update #__session set time = \'' . (time() + 7200) . '\',username = \'' . $session_id . '\' ' . 'where session_id =\'' . $ip . '\'';
    }
    $database->setQuery($query);
    $database->query();
    $errors = '';
    //Sanitize image path
    $image_path = preg_replace('/(^\\s*\\/|\\/\\s*$)/', '', $image_path);
    $xml_path = "{$mosConfig_absolute_path}/mambots/editors/fckeditor/fckstyles_template.xml";
    $template = $mainframe->getTemplate();
    if ($content_css || $editor_css) {
        if ($editor_css !== 0 & $content_css == 0) {
            if (is_file($mosConfig_absolute_path . '/templates/' . $template . '/css/editor_css.css')) {
                $content_css = 'templates/' . $template . '/css/editor_css.css';
            } else {
                if ($my->gid > $gid) {
                    $errors .= '<span style="color: red;">Warning: ' . $mosConfig_absolute_path . 'templates/' . $template . '/css/editor_css.css' . ' does not appear to be a valid file. Reverting to JoomlaFCK\'s default styles</span><br/>';
                }
                //end if gid > 29
            }
            //end if valid file
        } else {
            if (is_file($mosConfig_absolute_path . '/templates/' . $template . '/css/template_css.css')) {
                $content_css = 'templates/' . $template . '/css/template_css.css';
            } else {
                if (is_file($mosConfig_absolute_path . '/templates/' . $template . '/css/template.css.php')) {
                    $content_css = 'templates/' . $template . '/css/JFCKeditor.css.php';
                    if (!is_file($mosConfig_absolute_path . '/templates/' . $template . '/css/JFCKeditor.css.php') || filemtime($mosConfig_absolute_path . '/templates/' . $template . '/css/template.css.php') > filemtime($mosConfig_absolute_path . '/templates/' . $template . '/css/JFCKeditor.css.php')) {
                        $file_content = file_get_contents('../templates/' . $template . '/css/template.css.php');
                        $file_content = preg_replace_callback("/(.*?)(@?ob_start\\('?\"?ob_gzhandler\"?'?\\))(.*)/", create_function('$matches', 'return ($matches[1]) .\';\';'), $file_content);
                        $file_content = preg_replace("/(.*define\\().*DIRECTORY_SEPARATOR.*(;?)/", '', $file_content);
                        $file_content = '<' . '?' . 'php' . ' function getYooThemeCSS() { ' . '?' . '>' . $file_content . '<' . '?' . 'php' . ' } ' . '?' . '>';
                        $fout = fopen($path_root . $content_css, "w");
                        fwrite($fout, $file_content);
                        fclose($fout);
                    }
                    include $path_root . $content_css;
                    $content_css = 'templates/' . $template . '/css/JFCKeditor.css';
                    ob_start();
                    getYooThemeCSS();
                    $file_content = ob_get_contents();
                    ob_end_clean();
                    $fout = fopen($path_root . $content_css, "w");
                    fwrite($fout, $file_content);
                    fclose($fout);
                } else {
                    if ($my->gid > $gid) {
                        $errors .= '<span style="color: red;">Warning: ' . $mosConfig_absolute_path . 'templates/' . $template . '/css/template_css.css' . ' does not appear to be a valid file. Reverting to JoomlaFCK\'s default styles</span><br/>';
                    }
                    //end if gid > 29
                }
            }
            //end if valid file
        }
        //end if  $editor_css !== 0 & $content_css == 0
        /* Is the content_css == 0 or 1 then use FCK's default */
        if ($errors != "") {
            $content_css = 'mambots/editors/fckeditor/editor/css/fck_editorarea.css';
            $style_css = "fckstyles.xml";
        }
        //end if
        /*write to xml file and read from css asnd store this file under editors*/
        xml_writer($path_root . $content_css, $xml_path);
        $style_css = "fckstyles_template.xml";
    } else {
        if ($content_css_custom) {
            $hasRoot = strpos(' ' . strtolower($content_css_custom), strtolower($mosConfig_absolute_path));
            $file_path = ($hasRoot ? '' : $mosConfig_absolute_path) . ($hasRoot || substr($content_css_custom, 0, 1) == DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR) . $content_css_custom;
            if (is_file($file_path)) {
                $content_css = $file_path;
                $content_css = str_replace(strtolower($mosConfig_absolute_path) . DS, '', strtolower($content_css_custom));
                xml_writer($path_root . $content_css, $xml_path);
                $style_css = "fckstyles_template.xml";
            } else {
                if ($my->gid > $gid) {
                    $errors .= '<span style="color: red;">Warning: ' . $mosConfig_absolute_path . '/' . $content_css_custom . ' does not appear to be a valid file.</span><br/>';
                }
                //end if gid > $gid
                $content_css = 'mambots/editors/fckeditor/editor/css/fck_editorarea.css';
                $style_css = "fckstyles.xml";
            }
            //end if valid file
        } else {
            $content_css = 'mambots/editors/fckeditor/editor/css/fck_editorarea.css';
            $style_css = "fckstyles.xml";
        }
        //end if $content_css_custom
    }
    //end if $content_css || $editor_css
    if (strpos($width, '%') === false) {
        $WidthCSS = $width . 'px';
    } else {
        $WidthCSS = $width;
    }
    if (strpos($height, '%') === false) {
        $HeightCSS = $height . 'px';
    } else {
        $HeightCSS = $height;
    }
    //if additional stylesheets specified
    $stylesheet_name = '';
    if ($add_stylesheet_path) {
        $hasRoot = strpos(' ' . strtolower($add_stylesheet_path), strtolower($mosConfig_absolute_path));
        $add_stylesheet_path = str_replace(strtolower($mosConfig_absolute_path) . DIRECTORY_SEPARATOR, '', strtolower($add_stylesheet_path));
    } else {
        $add_stylesheet_path = '/templates/' . $template . '/css/';
    }
    $BaseAddCSSPath = (preg_match('/(^\\/|^\\\\)/', $add_stylesheet_path) ? '' : '/') . $add_stylesheet_path . (preg_match('/.(\\/$|\\\\$)/', $add_stylesheet_path) ? '' : '/');
    $BaseAddCSSPath = str_replace('\\', '/', $BaseAddCSSPath);
    //echo $add_stylesheet_path;
    if ($add_stylesheet_path && $add_stylesheet) {
        if (strpos($add_stylesheet, ';')) {
            $stylesheets = explode(';', $add_stylesheet);
        } else {
            $stylesheets[] = $add_stylesheet;
        }
        $count = 0;
        foreach ($stylesheets as $stylesheet) {
            if (!preg_match('/\\.\\w{3}$/', $stylesheet)) {
                $stylesheet .= '.css';
            }
            $fin = $path_root . substr($BaseAddCSSPath, 1, strlen($BaseAddCSSPath)) . $stylesheet;
            $file = $mosConfig_absolute_path . (preg_match('/(^\\/|^\\\\)/', $add_stylesheet_path) ? '' : DIRECTORY_SEPARATOR) . $add_stylesheet_path . (preg_match('/.(\\/$|\\\\$)/', $add_stylesheet_path) ? '' : DIRECTORY_SEPARATOR) . $stylesheet;
            $fout = $path_root . 'mambots/editors/fckeditor/' . str_replace('.css', '.xml', $stylesheet);
            if (is_file($file)) {
                xml_writer($fin, $fout);
            } else {
                if ($my->gid > $gid) {
                    $errors .= '<span style="color: red;">Warning: ' . $file . ' does not appear to be a valid file.</span><br/>';
                }
                //end if gid > $gid
                array_splice($stylesheets, $count, 1);
            }
            //end if valid file
            $count++;
        }
        $stylesheet_name = str_replace('.css', '', implode(';', $stylesheets));
    }
    $results = $_MAMBOTS->trigger('onCustomEditorButton');
    $buttons = array();
    foreach ($results as $result) {
        if ($result[0]) {
            $buttons[] = '<img src="' . $mosConfig_live_site . '/mambots/editors-xtd/' . $result[0] . '" onclick="InsertHTML(\'' . $hiddenField . '\',\'' . $result[1] . '\')" />';
        }
    }
    $buttons = implode("", $buttons);
    /* Lets sort out the directory issue */
    $urlDetails = parse_url($mosConfig_live_site);
    $directory = str_replace(array($urlDetails['scheme'], $urlDetails['host'], '://'), '', $mosConfig_live_site);
    if ($showerrors && $my->gid > $gid) {
        //Version Checker
        if (function_exists("curl_init")) {
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, 'http://www.joomlafckeditor.com/version.txt');
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            $version = curl_exec($ch);
            curl_close($ch);
            if ($version != '2.6.4.1' && $version) {
                $errors .= 'Please be aware there is a newer version of the JoomlaFCK Editor which can be downloaded from <a href="http://www.joomlafckeditor.com" target="_blank">http://www.joomlafckeditor.com</a>.<br/>';
            }
            //end if
        }
        //end if
        /* Check to see if the path exists. */
        if (!is_dir($mosConfig_absolute_path . '/' . $image_path)) {
            $errors .= '<span style="color: red;">Warning: ' . $mosConfig_absolute_path . $imagePath . ' does not appear to be a valid directory!</span><br/>';
        }
        //end if
        if ($errors !== "") {
            echo $errors . '<span style="color:blue">Please note the above message will only displayed to Managers and above.</span>';
        }
        //end if
    }
    $content_css = $mosConfig_live_site . '/' . $content_css;
    $content_css = str_replace('\\', '/', $content_css);
    // Define Enter & Shift Enter Mode
    $enterbehavior = array();
    $enterbehavior[0] = 'br';
    $enterbehavior[1] = 'p';
    $enterbehavior[2] = 'div';
    // Define Entities
    $htmlentities = $htmlentities ? 'true' : 'false';
    $includelatinentities = $includelatinentities ? 'true' : 'false';
    $includegreekentities = $includegreekentities ? 'true' : 'false';
    $numericentities = $numericentities ? 'true' : 'false';
    return <<<EOD
<textarea name="{$hiddenField}" id="{$hiddenField}" cols="{$col}" rows="{$row}" style="width:{$WidthCSS}; height:{$HeightCSS};">{$content}</textarea>
<script type="text/javascript">

\tvar oFCKeditor{$hiddenField} = new FCKeditor('{$hiddenField}');
\toFCKeditor{$hiddenField}.BasePath = "{$directory}/mambots/editors/fckeditor/" ;
\toFCKeditor{$hiddenField}.Config["SitePath"] =  "{$mosConfig_live_site}";
\toFCKeditor{$hiddenField}.Config["ImagePath"] =  "{$image_path}"; 
\toFCKeditor{$hiddenField}.Config["UseRelativeURLPath"] =  {$useRelativeURLPath}; 
\toFCKeditor{$hiddenField}.Config["CustomConfigurationsPath"] = "{$mosConfig_live_site}/mambots/editors/fckconfigjoomla.js";
\toFCKeditor{$hiddenField}.ToolbarSet = "{$toolbar}" ;
\toFCKeditor{$hiddenField}.Config['BaseAddCSSPath'] = "{$BaseAddCSSPath}";
\toFCKeditor{$hiddenField}.Config['EditorAreaCSS'] = "{$content_css}";
\toFCKeditor{$hiddenField}.Config['ContentLangDirection'] = "{$text_direction}" ;
\toFCKeditor{$hiddenField}.Config['SkinPath'] = oFCKeditor{$hiddenField}.BasePath + 'editor/skins/' + '{$skin}' + '/' ;
\toFCKeditor{$hiddenField}.Config['StylesXmlPath']= oFCKeditor{$hiddenField}.BasePath +'{$style_css}';
\toFCKeditor{$hiddenField}.Config['FormatSource'] = {$formatSource};\t
\toFCKeditor{$hiddenField}.Config['AddStylesheets'] = "{$stylesheet_name}";
\toFCKeditor{$hiddenField}.Config['BackgroundColor'] = "{$bgcolor}";
\toFCKeditor{$hiddenField}.Config['FontColor'] = "'.{$fontcolor}.'";\t
\toFCKeditor{$hiddenField}.Config['EnterMode'] = "{$enterbehavior[$entermode]}";
\toFCKeditor{$hiddenField}.Config['ShiftEnterMode'] = "{$enterbehavior[$shiftentermode]}";
\toFCKeditor{$hiddenField}.Config['CrtlShiftEnterMode'] = "{$enterbehavior[$crtlshiftentermode]}";
\toFCKeditor{$hiddenField}.Config['ProcessHTMLEntities'] = {$htmlentities} ;
\toFCKeditor{$hiddenField}.Config['IncludeLatinEntities'] = {$includelatinentities} ;
\toFCKeditor{$hiddenField}.Config['IncludeGreekEntities'] = {$includegreekentities} ;
\toFCKeditor{$hiddenField}.Config['ProcessNumericEntities'] = {$numericentities} ;
\toFCKeditor{$hiddenField}.Config['Pspell'] = "{$enablePspell}";
\toFCKeditor{$hiddenField}.Config['ForceInlineStyles'] = {$isInline};
\toFCKeditor{$hiddenField}.Config['JTemplate'] = "{$template}";
\toFCKeditor{$hiddenField}.Config['BodyStyles'] = "{$bodyStyles}";
\toFCKeditor{$hiddenField}.Config['TextAlign'] = "{$textAlign}";
\toFCKeditor{$hiddenField}.Config['UseAspell'] = "{$enablePspell}";
\toFCKeditor{$hiddenField}.Width = "{$wwidth}" ;
\toFCKeditor{$hiddenField}.Style_css = "{$style_css}" ;
\toFCKeditor{$hiddenField}.Height = "{$hheight}" ;
\t//oFCKeditor{$hiddenField}.ReplaceTextarea() ;
\t
\t
\t
\tvar forceSpellonSave = {$ForceSpellCheck}; 
\t
\tif(forceSpellonSave) {
\t
\t
\t\tif (!window.addEventListener) {
  \t\t\t  window.addEventListener = function (type, listener, useCapture) {
        \t\t\twindow.attachEvent('on' + type, function() { listener(event) });
    \t\t}
\t\t}
\t
\t\twindow.addEventListener("load", function() {
\t\t
\t\tif(typeof FCKIndexOf != "function")
\t\t{\t\t
\t\t\t\tvar FCKIndexOf = ( Array.prototype.indexOf ) ?
\t\t\t\t\t\tfunction( array, entry )
\t\t\t\t\t\t\t{
\t\t\t\t\t\t\t\treturn array.indexOf( entry );
\t\t\t\t\t\t\t}
\t\t\t\t\t:
\t\t\t\t\t\tfunction( array, entry )
\t\t\t\t\t\t{
\t\t\t\t\t\t\tfor ( var i = 0, len = array.length ; i < len ; i++ )
\t\t\t\t\t\t\t{
\t\t\t\t\t\t\t\tif ( array[ i ] === entry )
\t\t\t\t\t\t\t\t\treturn i;
\t\t\t\t\t\t\t}
\t\t\t\t\t\t\treturn -1;
\t\t\t\t\t\t};\t
\t\t\t
\t\t\t\t\t\t
\t\t\t\tfunction getElementByTitle( titles, obj ) {
\t\t\t\t
\t\t\t\t\tif (obj.title && FCKIndexOf(titles,obj.title) != -1 ) {
\t\t\t\t\t\t return obj;
\t\t\t\t\t}
\t\t\t\t\tfor ( var i = 0; i < obj.childNodes.length; i++ )
\t\t\t\t\t\t{
\t\t\t\t\t\t\tvar child = getElementByTitle( titles, obj.childNodes[i] );
\t\t\t\t\t\t\tif(child)
\t\t\t\t\t\t\t\treturn child;
\t\t\t\t\t\t}
\t\t\t\t\t
\t\t\t\t}\t
\t\t
\t\t\t\tvar submitbuttonOrig = submitbutton; // save fuction defintion defined by component
\t\t\t\t\t
\t\t\t\tif(typeof submitbutton == "function")
\t\t\t\t{
\t\t\t\t\t\t
\t\t\t\t\tfunction submitbuttonNew(pressbutton) //overide function defintion to call spellcheck on save
\t\t\t\t\t{
\t\t\t\t\t\t\t
\t\t\t\t\t\tif(pressbutton == "cancel" || pressbutton == "close" || pressbutton =="cpanel" )
\t\t\t\t\t\t{
\t\t\t\t\t\t\tsubmitbuttonOrig(pressbutton);
\t\t\t\t\t\t\treturn;
\t\t\t\t\t\t}
\t\t\t\t\t\t
\t\t\t\t\t\t\t\t
\t\t\t\t\t\tvar titles = ["Close","Cancel"];
\t\t\t\t\t\t
\t\t\t\t\t\tvar obj = getElementByTitle(titles,document); 
\t\t\t\t\t\t
\t\t\t\t\t\tvar exp = RegExp(pressbutton,"i");
\t\t\t\t\t\t
\t\t\t\t\t\tif(obj && obj.parentNode && exp.test(obj.parentNode.getAttribute("href")) )
\t\t\t\t\t\t{
\t\t\t\t\t\t\tsubmitbuttonOrig(pressbutton);
\t\t\t\t\t\t\treturn;
\t\t\t\t\t\t}
\t\t\t\t\t\t
\t\t\t\t\t\tvar FCK = FCKeditorAPI.GetInstance("{$hiddenField}");
\t\t\t\t\t\tFCK.submitform = submitbuttonOrig;
\t\t\t\t\t\tFCK.Config["saveAction"] = pressbutton;
\t\t\t\t\t\tFCK.ToolbarSet.CurrentInstance.Commands.GetCommand( "SpellCheck" ).Execute() ;
\t\t\t\t\t}
\t\t\t\t\t
\t\t\t\t\tsubmitbutton = submitbuttonNew; ' : "") . ' \t\t
\t\t\t\t}
\t\t\t}\t
\t\t},false);\t
\t}
\t
\t
\tfunction ReplaceText{$hiddenField}()
\t{
   \t\toFCKeditor{$hiddenField}.ReplaceTextarea();
   \t}
   
   \tif(window.addEvent)
\t{
\t\twindow.addEvent("domready",ReplaceText{$hiddenField})
\t}
\telse if(window.addEventListener)
\t{
\t\twindow.addEventListener("DOMContentLoaded", ReplaceText{$hiddenField}, null);
\t}
\telse
\t{
\t\twindow.attachEvent("onload",ReplaceText{$hiddenField})
\t
\t}\t
   
   
\tfunction InsertHTML(field, value) {
\t\t// Get the editor instance that we want to interact with.
\t\tvar oEditor = FCKeditorAPI.GetInstance(field) ;
\t
\t\t// Check the active editing mode.
\t\tif ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG )\t{
\t\t\t// Insert the desired HTML.
\t\t\toEditor.InsertHtml( value ) ;
\t\t} else {
\t\t\talert( 'Please switch to WYSIWYG mode.' ) ;
\t\t}//end if
\t}//end function

</script>
<br />
<p>{$buttons}</p>
EOD;
}
Exemple #17
0
 /**
  * Load Mambo generated head tags into an array
  */
 function loadHeadTags()
 {
     static $obj;
     if (!is_object($obj)) {
         $obj =& mosHtmlHelper::getInstance();
     }
     $mainframe =& mosMainFrame::getInstance();
     $obj->_headTags = array();
     $mainframe->appendMetaTag('description', mamboCore::get('mosConfig_MetaDesc'), true);
     $mainframe->appendMetaTag('keywords', mamboCore::get('mosConfig_MetaKeys'), true);
     $title = $mainframe->_head['title'];
     $obj->_headTags['title'] = $obj->tag('title', $title);
     $obj->_headTags['meta'] = array();
     foreach ($mainframe->_head['meta'] as $name => $meta) {
         if ($meta[1]) {
             $obj->_headTags['meta'][] = $meta[1];
         }
         $obj->_headTags['meta'][$name] = $obj->tag('meta', array($name, $meta[0]));
         if ($meta[2]) {
             $obj->_headTags['meta'][] = $meta[2];
         }
     }
     $my =& mamboCore::get('currentUser');
     $obj->_headTags['mambojavascript'] = $my->id ? $obj->tag('javascript', ' src="' . mamboCore::get('mosConfig_live_site') . "/includes/js/mambojavascript.js\"") : '';
     $obj->_headTags['custom'] = array();
     foreach ($mainframe->_head['custom'] as $html) {
         if (trim($html) !== '') {
             $obj->_headTags['custom'][] = $html;
         }
     }
     ob_start();
     $mainframe->liveBookMark();
     $obj->_headTags['livebookmark'] = trim(ob_get_contents());
     ob_end_clean();
     $configuration =& mamboCore::getMamboCore();
     $obj->_headTags['favicon'] = $obj->tag('metalinkrel', array("shortcut icon", $configuration->getFavIcon()));
 }
Exemple #18
0
        if (defined('_VALID_MOS') && class_exists('joomlaVersion')) {
            require_once S2_ROOT . DS . 's2framework' . DS . 'libs' . DS . 'cms_compat' . DS . 'joomla10.php';
            return CMS_JOOMLA10;
        } elseif (defined('_VALID_MOS') && class_exists('mamboCore')) {
            require_once S2_ROOT . DS . 's2framework' . DS . 'libs' . DS . 'cms_compat' . DS . 'mambo.php';
            return CMS_MAMBO46;
        }
    }
}
global $mainframe;
switch (getCmsVersion()) {
    case CMS_JOOMLA10:
    case CMS_MAMBO46:
        if (!is_object($mainframe)) {
            global $database, $option;
            $mainframe = new mosMainFrame($database, $option, '.');
            $mainframe->initSession();
        }
        define('PATH_ROOT', $mainframe->getCfg('absolute_path') . DS);
        define('WWW_ROOT', $mainframe->getCfg('live_site') . _DS);
        if (!defined('_PLUGIN_DIR_NAME')) {
            define('_PLUGIN_DIR_NAME', 'mambots');
        }
        break;
    case CMS_JOOMLA15:
    case CMS_JOOMLA16:
        define('PATH_ROOT', JPATH_SITE . DS);
        if (method_exists('mainframe', 'getSiteUrl')) {
            define('WWW_ROOT_ADMIN', $mainframe->getSiteURL());
            // Client side
        }
Exemple #19
0
require '../configuration.php';
// SSL check - $http_host returns <live site url>:<port number if it is 443>
$http_host = explode(':', $_SERVER['HTTP_HOST']);
if ((!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off' || isset($http_host[1]) && $http_host[1] == 443) && substr($mosConfig_live_site, 0, 8) != 'https://') {
    $mosConfig_live_site = 'https://' . substr($mosConfig_live_site, 7);
}
require_once $mosConfig_absolute_path . '/includes/joomla.php';
include_once $mosConfig_absolute_path . '/language/' . $mosConfig_lang . '.php';
require_once $mosConfig_absolute_path . '/administrator/includes/admin.php';
// must start the session before we create the mainframe object
session_name(md5($mosConfig_live_site));
session_start();
$option = strval(strtolower(mosGetParam($_REQUEST, 'option', '')));
$task = strval(mosGetParam($_REQUEST, 'task', ''));
// mainframe is an API workhorse, lots of 'core' interaction routines
$mainframe = new mosMainFrame($database, $option, '..', true);
// admin session handling
$my = $mainframe->initSessionAdmin($option, $task);
// initialise some common request directives
$act = strtolower(mosGetParam($_REQUEST, 'act', ''));
$section = mosGetParam($_REQUEST, 'section', '');
$no_html = intval(mosGetParam($_REQUEST, 'no_html', 0));
$id = intval(mosGetParam($_REQUEST, 'id', 0));
$cur_template = $mainframe->getTemplate();
// default admin homepage
if ($option == '') {
    $option = 'com_admin';
}
// set for overlib check
$mainframe->set('loadOverlib', false);
// precapture the output of the component
	function setUserState( $stateName, $stateValue ) {
		return $this->_baseFramework->setUserState( $stateName, $stateValue );
	}
Exemple #21
0
    /**
     * Writes a media_manager button
     * @param string The sub-drectory to upload the media to
     */
    function media_manager($directory = '')
    {
        $mainframe =& mosMainFrame::getInstance();
        $image = $mainframe->ImageCheck('upload.png', '/images/', NULL, NULL, T_('Upload Image'), 'uploadPic');
        $image2 = $mainframe->ImageCheck('upload_f2.png', '/images/', NULL, NULL, T_('Upload Image'), 'uploadPic', 0);
        ?>
		<td width="25" align="center">
		<a href="#" onclick="popupWindow('popups/uploadimage.php?directory=<?php 
        echo $directory;
        ?>
','win1',250,100,'no');" onmouseout="MM_swapImgRestore();"  onmouseover="MM_swapImage('uploadPic','','<?php 
        echo $image2;
        ?>
',1);">
		<?php 
        echo $image;
        ?>
		</a>
		</td>
		<?php 
    }
Exemple #22
0
} else {
    if (file_exists($mosConfig_absolute_path . "/language/admin_" . $mosConfig_alang . ".php")) {
        include_once $mosConfig_absolute_path . "/language/admin_" . $mosConfig_alang . ".php";
    }
}
$adminLanguage =& new adminLanguage();
require_once $mosConfig_absolute_path . "/administrator/includes/admin.php";
$database = new database($mosConfig_host, $mosConfig_user, $mosConfig_password, $mosConfig_db, $mosConfig_dbprefix);
$database->debug($mosConfig_debug);
$acl = new gacl_api();
$option = trim(strtolower(mosGetParam($_REQUEST, 'option', '')));
// must start the session before we create the mainframe object
session_name('mosadmin');
session_start();
// mainframe is an API workhorse, lots of 'core' interaction routines
$mainframe = new mosMainFrame($database, $option, '..', true);
// initialise some common request directives
$task = trim(mosGetParam($_REQUEST, 'task', ''));
$act = trim(strtolower(mosGetParam($_REQUEST, 'act', '')));
$section = trim(mosGetParam($_REQUEST, 'section', ''));
$mosmsg = trim(strip_tags(mosGetParam($_REQUEST, 'mosmsg', '')));
$no_html = strtolower(trim(mosGetParam($_REQUEST, 'no_html', '')));
if ($option == 'logout') {
    require 'logout.php';
    exit;
}
// restore some session variables
$my = new mosUser($database);
$my->id = mosGetParam($_SESSION, 'session_user_id', '');
$my->username = mosGetParam($_SESSION, 'session_username', '');
$my->usertype = mosGetParam($_SESSION, 'session_usertype', '');
Exemple #23
0
    /**
     * Display Table of items
     */
    function showTable(&$params, &$rows, $catid, $tabclass)
    {
        global $mosConfig_live_site, $Itemid;
        // icon in table display
        $mainframe =& mosMainFrame::getInstance();
        $img = $mainframe->ImageCheck('con_info.png', '/images/M_images/', $params->get('icon'));
        ?>
		<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
		<?php 
        if ($params->get('headings')) {
            ?>
			<tr>
				<?php 
            if ($params->get('name')) {
                ?>
					<td height="20" class="sectiontableheader<?php 
                echo $params->get('pageclass_sfx');
                ?>
">
					<?php 
                echo T_('Feed Name');
                ?>
					</td>
					<?php 
            }
            ?>
				<?php 
            if ($params->get('articles')) {
                ?>
					<td height="20" class="sectiontableheader<?php 
                echo $params->get('pageclass_sfx');
                ?>
" align="center">
					<?php 
                echo T_('# Articles');
                ?>
					</td>
					<?php 
            }
            ?>
				<?php 
            if ($params->get('link')) {
                ?>
					<td height="20" class="sectiontableheader<?php 
                echo $params->get('pageclass_sfx');
                ?>
">
					<?php 
                echo T_('Feed Link');
                ?>
					</td>
					<?php 
            }
            ?>
				<td width="100%" class="sectiontableheader<?php 
            echo $params->get('pageclass_sfx');
            ?>
"></td>
			</tr>
			<?php 
        }
        $k = 0;
        foreach ($rows as $row) {
            $link = 'index.php?option=com_newsfeeds&amp;task=view&amp;feedid=' . $row->id . '&amp;Itemid=' . $Itemid;
            ?>
			<tr>
				<?php 
            if ($params->get('name')) {
                ?>
					<td width="30%" height="20" class="<?php 
                echo $tabclass[$k];
                ?>
"> 
					<a href="<?php 
                echo sefRelToAbs($link);
                ?>
" class="category<?php 
                echo $params->get('pageclass_sfx');
                ?>
">
					<?php 
                echo $row->name;
                ?>
 
					</a> 
					</td>
					<?php 
            }
            ?>
				<?php 
            if ($params->get('articles')) {
                ?>
					<td width="20%" class="<?php 
                echo $tabclass[$k];
                ?>
" align="center">
					<?php 
                echo $row->numarticles;
                ?>
					</td>
					<?php 
            }
            ?>
				<?php 
            if ($params->get('link')) {
                ?>
					<td width="50%" class="<?php 
                echo $tabclass[$k];
                ?>
">
					<?php 
                echo $row->link;
                ?>
					</td>
					<?php 
            }
            ?>
				<td width="100%"></td>
			</tr>
			<?php 
            $k = 1 - $k;
        }
        ?>
		</table>
		<?php 
    }
Exemple #24
0
/**
* Assembles head tags
*/
function mosShowHead($keys = '', $exclude = '')
{
    $mainframe =& mosMainFrame::getInstance();
    $mainframe->mosShowHead($keys, $exclude);
}
Exemple #25
0
require '../configuration.php';
// SSL check - $http_host returns <live site url>:<port number if it is 443>
$http_host = explode(':', $_SERVER['HTTP_HOST']);
if ((!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off' || isset($http_host[1]) && $http_host[1] == 443) && substr($mosConfig_live_site, 0, 8) != 'https://') {
    $mosConfig_live_site = 'https://' . substr($mosConfig_live_site, 7);
}
require_once $mosConfig_absolute_path . '/includes/joomla.php';
include_once $mosConfig_absolute_path . '/language/' . $mosConfig_lang . '.php';
require_once $mosConfig_absolute_path . '/administrator/includes/admin.php';
// must start the session before we create the mainframe object
session_name(md5($mosConfig_live_site));
session_start();
$option = strval(strtolower(mosGetParam($_REQUEST, 'option', '')));
$task = strval(mosGetParam($_REQUEST, 'task', ''));
// mainframe is an API workhorse, lots of 'core' interaction routines
$mainframe = new mosMainFrame($database, $option, '..', true);
// admin session handling
$my = $mainframe->initSessionAdmin($option, $task);
// initialise some common request directives
$act = strtolower(mosGetParam($_REQUEST, 'act', ''));
$section = mosGetParam($_REQUEST, 'section', '');
$mosmsg = strval(strip_tags(mosGetParam($_REQUEST, 'mosmsg', '')));
$no_html = mosGetParam($_REQUEST, 'no_html', '');
$id = intval(mosGetParam($_REQUEST, 'id', 0));
// start the html output
if ($no_html) {
    if ($path = $mainframe->getPath('admin')) {
        require $path;
    }
    exit;
}
 *
 * @version     $Id: mod_events_latest.php 372 2007-01-20 20:16:39Z tstahl $
 * @package     Events
 * @subpackage  Module Latest Events
 * @copyright   Copyright (C) 2006-2007 JEvents Project Group
 * @copyright   Copyright (C) 2000 - 2003 Dave McDonnell
 * @licence     http://www.gnu.org/copyleft/gpl.html
 * @link        http://joomlacode.org/gf/project/jevents
 */
/**
 * Library for Latest Events Module
 **/
// following line is to prevent direct access to this script via the url
defined('_VALID_MOS') or die('Restricted access');
// setup for all required function and classes
$file = mosMainFrame::getBasePath() . 'components/com_events/includes/modutils.php';
if (file_exists($file)) {
    include_once $file;
} else {
    die("Events Latest\n<br />This module needs the Events component");
}
// load language constants
EventsHelper::loadLanguage('modlatest');
if (!defined('EVENTS_LATEST_MODULE')) {
    define('EVENTS_LATEST_MODULE', 1);
    function JEventsLatestcmpByStartTime(&$a, &$b)
    {
        // this custom sort compare function compares the start times of events that are referenced by the a & b vars
        if ($a->publish_up == $b->publish_up) {
            return 0;
        }
/**
 * JoomlaAuthenticatorImpl.php
 *
 * @package MCFileManager.authenicators
 * @author Moxiecode
 * @copyright Copyright © 2005-2006, Moxiecode Systems AB, All rights reserved.
 */
// Include Joomla bootstrap logic
@session_destroy();
chdir("../../../../../../../");
define('_VALID_MOS', 1);
include_once 'globals.php';
require_once 'configuration.php';
require_once 'includes/joomla.php';
$mainframe = new mosMainFrame($database, $option, '.');
$mainframe->initSession();
$mamboUser =& $mainframe->getUser();
chdir("mambots/editors/tinymce/jscripts/tiny_mce/plugins/filemanager/");
/**
 * This class is a Jomla CMS authenticator implementation.
 *
 * @package MCFileManager.Authenticators
 */
class JoomlaAuthenticatorImpl extends BaseAuthenticator
{
    /**#@+
     * @access public
     */
    var $_config;
    /**
Exemple #28
0
if (file_exists("../../globals.php")) {
    if (count($_GET)) {
        die2("Intruder Alert 15!");
    }
    /** Set flag that this is a parent file */
    define("_VALID_MOS", 1);
    require_once "../../globals.php";
    // clears everything
    require_once "../../configuration.php";
    // mosConfig_absolute_path
    require_once "../../includes/database.php";
    // $database
    require_once "../../includes/joomla.php";
    // mosCommonHTML
    global $mainframe, $my, $database;
    $mainframe = new mosMainFrame($database, '', '.');
    $mainframe->initSession();
    $my = $mainframe->getUser();
    //    @ob_clean();
} else {
    require_once "../../index2.php";
    //  @ob_clean();
}
global $database, $mosConfig_live_site, $mosConfig_sitename, $mosConfig_mailfrom, $my, $mosConfig_absolute_path;
require_once "../../administrator/components/com_performs/lib/myLib.php";
require_once "../../administrator/components/com_performs/lib/lib_template.php";
//this lib injects html in ob_
require_once "../../administrator/components/com_performs/lib/lib_valid.php";
require_once "../../administrator/components/com_performs/lib/lib_replace.php";
require_once "../../administrator/components/com_performs/lib/lib_phpForm.php";
require_once "../../administrator/components/com_performs/class.performs.php";
Exemple #29
0
        }
    }
}
/** do we have a valid Itemid yet?? */
if ($Itemid === null) {
    /** Nope, just use the homepage then. */
    $query = "SELECT id" . "\n FROM #__menu" . "\n WHERE menutype='mainmenu'" . "\n AND published='1'" . "\n ORDER BY parent, ordering" . "\n LIMIT 1";
    $database->setQuery($query);
    $Itemid = $database->loadResult();
}
/** patch to lessen the impact on templates */
if ($option == 'search') {
    $option = 'com_search';
}
/** mainframe is an API workhorse, lots of 'core' interaction routines */
$mainframe = new mosMainFrame($database, $option, '.');
$mainframe->initSession();
// loads english language file by default
if ($mosConfig_lang == '') {
    $mosConfig_lang = 'english';
}
include_once 'language/' . $mosConfig_lang . '.php';
// frontend login & logout controls
$return = mosGetParam($_REQUEST, 'return', NULL);
$message = mosGetParam($_POST, 'message', 0);
if ($option == "login") {
    $mainframe->login();
    // JS Popup message
    if ($message) {
        ?>
		<script> 
Exemple #30
0
/**
 * Shows the email form for a given content item.
 * @param int The content item id
 */
function emailContentSend($uid, $gid)
{
    global $database, $mainframe;
    global $mosConfig_live_site, $mosConfig_sitename, $mosConfig_hideEmail;
    $id = intval(mosGetParam($_REQUEST, 'id', 0));
    if ($id) {
        $query = 'SELECT attribs FROM #__content WHERE `id`=' . $id;
        $database->setQuery($query);
        $params = new mosParameters($database->loadResult());
    } else {
        $params = new mosParameters('');
    }
    $paramEmail = intval($params->get('email', 0));
    if ($mosConfig_hideEmail && !$paramEmail) {
        echo _NOT_AUTH;
        return;
    }
    // simple spoof check security
    josSpoofCheck(1);
    // check for session cookie
    // Session Cookie `name`
    $sessionCookieName = mosMainFrame::sessionCookieName();
    // Get Session Cookie `value`
    $sessioncookie = mosGetParam($_COOKIE, $sessionCookieName, null);
    if (!(strlen($sessioncookie) == 32 || $sessioncookie == '-')) {
        mosErrorAlert(_NOT_AUTH);
    }
    $itemid = intval(mosGetParam($_POST, 'itemid', 0));
    $now = _CURRENT_SERVER_TIME;
    $nullDate = $database->getNullDate();
    // query to check for state and access levels
    $query = "SELECT a.*, cc.name AS category, s.name AS section, s.published AS sec_pub, cc.published AS cat_pub," . "\n  s.access AS sec_access, cc.access AS cat_access, s.id AS sec_id, cc.id as cat_id" . "\n FROM #__content AS a" . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" . "\n LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope = 'content'" . "\n WHERE a.id = " . (int) $uid . "\n AND a.state = 1" . "\n AND a.access <= " . (int) $gid . "\n AND ( a.publish_up = " . $database->Quote($nullDate) . " OR a.publish_up <= " . $database->Quote($now) . " )" . "\n AND ( a.publish_down = " . $database->Quote($nullDate) . " OR a.publish_down >= " . $database->Quote($now) . " )";
    $database->setQuery($query);
    $row = NULL;
    if ($database->loadObject($row)) {
        /*
         * check whether category is published
         */
        if (!$row->cat_pub && $row->catid) {
            mosNotAuth();
            return;
        }
        /*
         * check whether section is published
         */
        if (!$row->sec_pub && $row->sectionid) {
            mosNotAuth();
            return;
        }
        /*
         * check whether category access level allows access
         */
        if ($row->cat_access > $gid && $row->catid) {
            mosNotAuth();
            return;
        }
        /*
         * check whether section access level allows access
         */
        if ($row->sec_access > $gid && $row->sectionid) {
            mosNotAuth();
            return;
        }
        $email = strval(mosGetParam($_POST, 'email', ''));
        $yourname = strval(mosGetParam($_POST, 'yourname', ''));
        $youremail = strval(mosGetParam($_POST, 'youremail', ''));
        $subject = strval(mosGetParam($_POST, 'subject', ''));
        if (empty($subject)) {
            $subject = _EMAIL_INFO . ' ' . $yourname;
        }
        if ($uid < 1 || !$email || !$youremail || JosIsValidEmail($email) == false || JosIsValidEmail($youremail) == false) {
            mosErrorAlert(_EMAIL_ERR_NOINFO);
        }
        $query = "SELECT template" . "\n FROM #__templates_menu" . "\n WHERE client_id = 0" . "\n AND menuid = 0";
        $database->setQuery($query);
        $template = $database->loadResult();
        // determine Itemid for Item
        if ($itemid) {
            $_itemid = '&Itemid=' . $itemid;
        } else {
            $itemid = $mainframe->getItemid($uid, 0, 0);
            $_itemid = '&Itemid=' . $itemid;
        }
        // link sent in email
        $link = sefRelToAbs('index.php?option=com_content&task=view&id=' . $uid . $_itemid);
        // message text
        $msg = sprintf(_EMAIL_MSG, html_entity_decode($mosConfig_sitename, ENT_QUOTES), $yourname, $youremail, $link);
        // mail function
        $success = mosMail($youremail, $yourname, $email, $subject, $msg);
        if (!$success) {
            mosErrorAlert(_EMAIL_ERR_NOINFO);
        }
        HTML_content::emailSent($email, $template);
    } else {
        mosNotAuth();
        return;
    }
}