Exemplo n.º 1
0
 /**
  * Draws the menu for Editing an existing module
  */
 function _EDIT()
 {
     global $id;
     mosMenuBar::startTable();
     mosMenuBar::save();
     mosMenuBar::spacer();
     mosMenuBar::apply();
     mosMenuBar::spacer();
     if ($id) {
         // for existing content items the button is renamed `close`
         mosMenuBar::cancel('cancel', T_('Close'));
     } else {
         mosMenuBar::cancel();
     }
     mosMenuBar::spacer();
     if ($GLOBALS['task'] == 'new') {
         mosMenuBar::help('new');
     } else {
         if ($_POST) {
             $cid = (int) $GLOBALS['cid'][0];
         } else {
             $cid = (int) $_GET['id'];
         }
         $database =& mamboDatabase::getInstance();
         $database->setQuery('select element from #__mambots where id = ' . $cid);
         $result = $database->loadResult();
         mosMenuBar::help($result ? $result : 'edit');
     }
     mosMenuBar::endTable();
 }
Exemplo n.º 2
0
    /**
     * Draws the menu for Editing an existing module
     */
    function _EDIT($cur_template, $publish)
    {
        global $id;
        mosMenuBar::startTable();
        ?>
			<td><a class="toolbar" href="#" onClick="if (typeof document.adminForm.content == 'undefined') { alert('<?php 
        echo T_('You can only preview typed modules.');
        ?>
'); } else { var content = document.adminForm.content.value; content = content.replace('#', '');  var title = document.adminForm.title.value; title = title.replace('#', ''); window.open('popups/modulewindow.php?title=' + title + '&content=' + content + '&t=<?php 
        echo $cur_template;
        ?>
', 'win1', 'status=no,toolbar=no,scrollbars=auto,titlebar=no,menubar=no,resizable=yes,width=200,height=400,directories=no,location=no'); }" onmouseout="MM_swapImgRestore();"  onmouseover="MM_swapImage('preview','','images/preview_f2.png',1);"><img src="images/preview.png" alt="<?php 
        echo T_('Preview');
        ?>
" border="0" name="preview" align="middle"><br /><?php 
        echo T_('Preview');
        ?>
</a></td>
		<?php 
        mosMenuBar::spacer();
        mosMenuBar::save();
        mosMenuBar::spacer();
        mosMenuBar::apply();
        mosMenuBar::spacer();
        if ($id) {
            // for existing content items the button is renamed `close`
            mosMenuBar::cancel('cancel', T_('Close'));
        } else {
            mosMenuBar::cancel();
        }
        mosMenuBar::spacer();
        $result = '';
        if ($_POST) {
            $cid = (int) $GLOBALS['cid'][0];
        } else {
            $cid = (int) $_GET['id'];
        }
        $database =& mamboDatabase::getInstance();
        $database->setQuery('select module from #__modules where id = ' . $cid);
        $result = substr($database->loadResult(), 4);
        mosMenuBar::help($result ? $result : 'edit');
        mosMenuBar::endTable();
    }
Exemplo n.º 3
0
/**
* @param string SQL with ordering As value and 'name field' AS text
* @param integer The length of the truncated headline
*/
function mosGetOrderingList($sql, $chop = '30')
{
    $database = mamboDatabase::getInstance();
    $database->setQuery($sql);
    if (!($orders = $database->loadObjectList())) {
        if ($database->getErrorNum()) {
            echo $database->stderr();
            return false;
        } else {
            $order[] = mosHTML::makeOption(1, 'first');
            return $order;
        }
    }
    $order[] = mosHTML::makeOption(0, '0 first');
    foreach ($orders as $ord) {
        $text = strlen($ord->text) > $chop ? substr($ord->text, 0, $chop) . "..." : $ord->text;
        $order[] = mosHTML::makeOption($ord->value, $ord->value . ' (' . $text . ')');
    }
    $order[] = mosHTML::makeOption($ord->value + 1, $ord->value + 1 . ' last');
    return $order;
}
Exemplo n.º 4
0
 /**
  * mosModuleHandler Class contructor 
  *
  * Init the database object.
  *
  * @access private
  */
 function mosModuleHandler()
 {
     $this->_db =& mamboDatabase::getInstance();
 }
Exemplo n.º 5
0
 function mosAuthorisationAdmin()
 {
     $this->connection =& mamboDatabase::getInstance();
 }
Exemplo n.º 6
0
 function getCategory($id)
 {
     $database =& mamboDatabase::getInstance();
     $limit = $this->_category_limit;
     if (!$this->_category_status) {
         $database->setQuery("SELECT i.id, i.catid FROM #__content AS i, #__categories AS s WHERE i.catid=s.id ORDER BY i.id DESC LIMIT {$limit}");
         $categories = $database->loadObjectList();
         if ($categories) {
             foreach ($categories as $category) {
                 $this->_categories[$category->id] = $category->catid;
             }
             $this->_category_status = count($categories);
         }
     }
     if ($this->_category_status) {
         if (isset($this->_categories[$id])) {
             return $this->_categories[$id];
         }
         if (count($this->_categories) < $limit) {
             return 0;
         }
         $database->setQuery("SELECT i.catid FROM #__content AS i, #__categories AS s WHERE i.catid=s.id AND i.id={$id}");
         return $database->loadResult();
     } else {
         return 0;
     }
 }
Exemplo n.º 7
0
/**
 * Mambot install method
 * @param int The id of the module
 * @param string The URL option
 * @param int The client id
 */
function mambot_uninstall($id, $option, $client = 0)
{
    $database =& mamboDatabase::getInstance();
    $mosConfig_absolute_path = mamboCore::get('mosConfig_absolute_path');
    $database->setQuery("SELECT name, folder, element, iscore FROM #__mambots WHERE id = {$id}");
    $database->loadObject($row);
    if ($database->getErrorNum()) {
        $message = new mosError($database->stderr(), _MOS_ERROR_FATAL);
        HTML_installer::showInstallMessage($message, T_('Uninstall -  error'), returnTo($option, 'mambot', $client));
        exit;
    }
    if ($row == null) {
        $message = new mosError(T_('Invalid object id'), _MOS_ERROR_FATAL);
        HTML_installer::showInstallMessage($message, T_('Uninstall -  error'), returnTo($option, 'mambot', $client));
        exit;
    }
    if (trim($row->folder) == '') {
        $message = new mosError(T_('Folder field empty, cannot remove files'), _MOS_ERROR_FATAL);
        HTML_installer::showInstallMessage($message, T_('Uninstall -  error'), returnTo($option, 'mambot', $client));
        exit;
    }
    $xmlfile = $mosConfig_absolute_path . '/mambots/' . $row->folder . '/' . $row->element . '.xml';
    if (file_exists($xmlfile)) {
        $parser =& new mosUninstallXML($xmlfile);
        $ret = $parser->uninstall();
        $showerrors = $parser->getErrors();
    } else {
        $database->setQuery("DELETE FROM #__mambots WHERE id = {$id}");
        $ret = $database->query();
        $showerrors = new mosError(T_('Uninstaller did its best with no XML file present'), _MOS_ERROR_WARN);
    }
    HTML_installer::showInstallMessage($showerrors, T_('Uninstall mambot - ') . ($ret ? T_('Success') : T_('Error')), returnTo($option, 'mambot', $client));
    exit;
}
Exemplo n.º 8
0
$version = $_VERSION->PRODUCT . ' ' . $_VERSION->RELEASE . '.' . $_VERSION->DEV_LEVEL . ' ' . $_VERSION->DEV_STATUS . ' [ ' . $_VERSION->CODENAME . ' ] ' . $_VERSION->RELDATE . ' ' . $_VERSION->RELTIME . ' ' . $_VERSION->RELTZ;
if (phpversion() < '4.2.0') {
    require_once $configuration->rootPath() . '/includes/compat.php41x.php';
}
if (phpversion() < '4.3.0') {
    require_once $configuration->rootPath() . '/includes/compat.php42x.php';
}
if (phpversion() < '5.0.0') {
    require_once $configuration->rootPath() . '/includes/compat.php5xx.php';
}
$local_backup_path = $configuration->rootPath() . '/administrator/backups';
$media_path = $configuration->rootPath() . '/media/';
$image_path = $configuration->rootPath() . '/images/stories';
$lang_path = $configuration->rootPath() . '/language';
$image_size = 100;
$database =& mamboDatabase::getInstance();
// Start NokKaew patch
$mosConfig_nok_content = 0;
if (file_exists($configuration->rootPath() . 'components/com_nokkaew/nokkaew.php') && !$adminside) {
    $mosConfig_nok_content = 1;
    // can also go into the configuration - but this might be overwritten!
    require_once $configuration->rootPath() . "administrator/components/com_nokkaew/nokkaew.class.php";
    require_once $configuration->rootPath() . "components/com_nokkaew/classes/nokkaew.class.php";
}
if ($mosConfig_nok_content) {
    $database = new mlDatabase($mosConfig_host, $mosConfig_user, $mosConfig_password, $mosConfig_db, $mosConfig_dbprefix);
}
if ($mosConfig_nok_content) {
    $mosConfig_defaultLang = $mosConfig_locale;
    // Save the default language of the site
    $iso_client_lang = NokKaew::discoverLanguage($database);
Exemplo n.º 9
0
/**
* Copy the named array content into the object as properties
* only existing properties of object are filled. when undefined in hash, properties wont be deleted
* @param array the input array
* @param obj byref the object to fill of any class
* @param string
* @param boolean
*/
function mosBindArrayToObject($array, &$obj, $ignore = '', $prefix = NULL, $checkSlashes = true)
{
    $database =& mamboDatabase::getInstance();
    return $database->mosBindArrayToOBject($array, $obj, $ignore = '', $prefix = NULL, $checkSlashes = true);
}
Exemplo n.º 10
0
 function mosSpecialAdminParameters($name, $version = '')
 {
     $database =& mamboDatabase::getInstance();
     $sql = "SELECT * FROM #__parameters WHERE param_name='{$name}'";
     if ($version) {
         $sql .= " AND param_version='{$version}'";
     }
     $database->setQuery($sql);
     $parameters = $database->loadObjectList();
     if ($parameters) {
         $parameters = $parameters[0];
     }
     parent::mosAdminParameters($parameters->params, mamboCore::get('mosConfig_absolute_path') . '/parameters/' . $parameters->param_file);
 }
Exemplo n.º 11
0
 function purge()
 {
     $past = time() - intval(mamboCore::get('mosConfig_lifetime'));
     $adminpast = time() - 3600;
     $database =& mamboDatabase::getInstance();
     $database->setQuery("DELETE FROM #__session WHERE (time<{$past} AND guest>=0) OR (time<{$adminpast} AND guest<0)");
     return $database->query();
 }
Exemplo n.º 12
0
 function &loginAdmin($acl)
 {
     $database =& mamboDatabase::getInstance();
     /** escape and trim to minimise injection of malicious sql */
     $usrname = $database->getEscaped(mosGetParam($_POST, 'usrname', ''));
     $pass = $database->getEscaped(mosGetParam($_POST, 'pass', ''));
     $my = null;
     if (!$pass) {
         echo "<script>alert('" . T_('Please enter a password') . "'); document.location.href='index.php';</script>\n";
     } else {
         $pass = md5($pass);
     }
     $admintypes = array('administrator', 'superadministrator', 'super administrator');
     $admins = 0;
     $query = "SELECT u.*, a.name as usertype, a.lft as grp FROM #__users AS u, #__core_acl_aro_groups AS a" . "\n WHERE ( LOWER( usertype ) = 'administrator'" . "\n OR LOWER( usertype ) = 'superadministrator'" . "\n OR LOWER( usertype ) = 'super administrator'" . "\n OR (username='******' AND block=0)) AND a.group_id = u.gid";
     $users = $database->doSQLget($query, 'mosUser');
     foreach ($users as $key => $oneuser) {
         if (in_array(strtolower($oneuser->usertype), $admintypes)) {
             $admins++;
         }
         if ($oneuser->username == $usrname) {
             $my =& $users[$key];
         }
     }
     if ($admins == 0) {
         echo "<script>alert(\"" . T_('You cannot login. There are no administrators set up.') . "\"); window.history.go(-1); </script>\n";
     } elseif (isset($my)) {
         if (strcmp($my->password, $pass) or !$acl->acl_check('administration', 'login', 'users', $my->usertype)) {
             echo "<script>alert('" . T_('Incorrect Username, Password, or Access Level.  Please try again') . "'); document.location.href='index.php';</script>\n";
             return;
         }
         $logintime = time();
         $session_id = md5("{$my->id}{$my->username}{$my->usertype}{$logintime}");
         $query = "INSERT INTO #__session" . "\nSET time='{$logintime}', session_id='{$session_id}', " . "userid='{$my->id}', usertype='{$my->usertype}', username='******', guest=-1";
         $database->setQuery($query);
         if (!$database->query()) {
             echo $database->stderr();
         }
         $_SESSION['session_id'] = $session_id;
         $_SESSION['session_user_id'] = $my->id;
         $_SESSION['session_username'] = $my->username;
         $_SESSION['session_usertype'] = $my->usertype;
         $_SESSION['session_gid'] = $my->gid;
         $_SESSION['session_grp'] = $my->grp;
         $_SESSION['session_logintime'] = $logintime;
         $_SESSION['session_userstate'] = array();
     }
     return $my;
 }
Exemplo n.º 13
0
 function uninstall_mambot()
 {
     $this->user_dir = mosPathName(mamboCore::get('mosConfig_absolute_path') . '/mambots/' . $this->group);
     $this->deleteFileSet($this->files, $this->user_dir);
     $this->deleteFileSet($this->images, $this->user_dir);
     $database =& mamboDatabase::getInstance();
     $name = $this->getName('mambot');
     $element = $this->special_file[0];
     $group = $this->group;
     $sql = "DELETE FROM #__mambots WHERE element='{$element}' AND folder='{$group}'";
     $database->setQuery($sql);
     if (!$database->query()) {
         $this->errors->addErrorDetails(sprintf(T_('Uninstaller error with %s: %s %s not fully deleted from database'), $this->xmlfile, 'mambot', $name), _MOS_ERROR_SEVERE);
         return;
     }
     $fmanager =& mosFileManager::getInstance();
     $fmanager->deleteFile($this->xmlfile);
     $this->errors->addErrorDetails($this->getDescription('mambot'), _MOS_ERROR_INFORM);
 }
Exemplo n.º 14
0
 function readDataBase($sql)
 {
     $database = mamboDatabase::getInstance();
     $database->setQuery($sql);
     if (!$database->loadObject($this)) {
         $this->id = 0;
     }
 }
Exemplo n.º 15
0
 function markTrash()
 {
     $database = mamboDatabase::getInstance();
     foreach ($this->rows as $row) {
         if ($row->isTrash()) {
             $trash[] = $row->id;
         }
     }
     if (isset($trash)) {
         $trashlist = implode(',', $trash);
         $sql = "DELETE FROM #__containers WHERE id IN ({$trashlist})";
         $database->doSQL($sql);
     }
 }
Exemplo n.º 16
0
 function view()
 {
     $database = mamboDatabase::getInstance();
     $query = "SELECT a.*, a.id AS value, CONCAT_WS( ' - ', a.name, a.con_position ) AS text" . "\n FROM #__contact_details AS a" . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" . "\n WHERE a.published = '1'" . "\n AND cc.published = '1'" . "\n AND a.access <=" . $this->user->gid . "\n AND cc.access <=" . $this->user->gid . "\n ORDER BY a.default_con DESC, a.ordering ASC";
     $database->setQuery($query);
     $list = $database->loadObjectList();
     $count = count($list);
     if ($count == 0) {
         $params =& new mosParameters('');
         $params->def('back_button', mamboCore::get('mosConfig_back_button'));
         HTML_contact::nocontact($params);
         return;
     }
     if ($this->contact_id == 0) {
         $this->contact_id = $list[0]->id;
     }
     foreach ($list as $cont) {
         if ($cont->id == $this->contact_id) {
             $contact =& $cont;
             break;
         }
     }
     if (!isset($contact)) {
         echo T_('You are not authorized to view this resource.');
         return;
     }
     // creates dropdown select list
     $contact->select = mosHTML::selectList($list, 'contact_id', 'class="inputbox" onchange="ViewCrossReference(this);"', 'value', 'text', $this->contact_id);
     // Adds parameter handling
     $params =& $this->makeParams($contact->params);
     // load mambot params info
     $query = "SELECT id FROM #__mambots WHERE element = 'mosemailcloak' AND folder = 'content'";
     $database->setQuery($query);
     $id = $database->loadResult();
     $mambot = new mosMambot($database);
     $mambot->load($id);
     $params2 =& $this->makeParams($mambot->params);
     if ($contact->email_to and $params->get('email')) {
         // email cloacking
         $contact->email = mosHTML::emailCloaking($contact->email_to, $params2->get('mode'));
     }
     // loads current template for the pop-up window
     $pop = mosGetParam($_REQUEST, 'pop', 0);
     if ($pop) {
         $params->set('popup', 1);
         $params->set('back_button', 0);
     }
     if ($params->get('email_description')) {
         $params->set('email_description', $params->get('email_description_text'));
     } else {
         $params->set('email_description', '');
     }
     // needed to control the display of the Address marker
     $temp = $params->get('street_address') . $params->get('suburb') . $params->get('state') . $params->get('country') . $params->get('postcode');
     $params->set('address_check', $temp);
     // determines whether to use Text, Images or nothing to highlight the different info groups
     $this->groupMarking($params);
     // params from menu item
     $menuhandler = mosMenuHandler::getInstance();
     $menu =& $menuhandler->getMenuByID($this->Itemid);
     $menu_params =& new mosParameters($menu->params);
     $menu_params->def('page_title', 1);
     $menu_params->def('header', $menu->name);
     $menu_params->def('pageclass_sfx', '');
     HTML_contact::viewcontact($contact, $params, $count, $list, $menu_params);
 }
Exemplo n.º 17
0
 function &getContacts($catid, $user)
 {
     $database = mamboDatabase::getInstance();
     $query = "SELECT *" . "\n FROM #__contact_details" . "\n WHERE catid = '" . $catid . "'" . "\n AND published='1'" . "\n AND access <= '" . $user->gid . "'" . "\n ORDER BY ordering";
     $contacts = $database->doSQLget($query, 'mosContact');
     return $contacts;
 }