Ejemplo n.º 1
0
 public static function prepare(array $data = array(), DocumentParser $modx, $_DocLister, prepare_DL_Extender $_extDocLister)
 {
     if (isset($data['images'])) {
         $wrapper = '';
         $imageField = $_DocLister->getCfgDef('imageField', 'sg_image');
         $thumbOptions = $_DocLister->getCfgDef('thumbOptions');
         $thumbSnippet = $_DocLister->getCfgDef('thumbSnippet');
         foreach ($data['images'] as $image) {
             $ph = $image;
             if (!empty($thumbOptions) && !empty($thumbSnippet)) {
                 $ph['thumb.' . $imageField] = $modx->runSnippet($thumbSnippet, array('input' => $image[$imageField], 'options' => $thumbOptions));
                 $info = getimagesize(MODX_BASE_PATH . $ph['thumb.' . $imageField]);
                 $ph['thumb.width.' . $imageField] = $info[0];
                 $ph['thumb.height.' . $imageField] = $info[1];
             }
             //сделали превьюшку
             $ph['e.sg_title'] = htmlentities($image['sg_title'], ENT_COMPAT, 'UTF-8', false);
             $ph['e.sg_description'] = htmlentities($image['sg_description'], ENT_COMPAT, 'UTF-8', false);
             //добавили поля e.sg_title и e.sg_description
             $properties = json_decode($image['sg_properties'], true);
             foreach ($properties as $key => $value) {
                 $ph['properties.' . $key] = $value;
             }
             $wrapper .= $_DocLister->parseChunk($_DocLister->getCfgDef('sgRowTpl'), $ph);
             //обработали чанк sgRowTpl - для каждой картинки
         }
         $data['images'] = $_DocLister->parseChunk($_DocLister->getCfgDef('sgOuterTpl'), array('wrapper' => $wrapper));
         //обработали чанк sgOuterTpl
     }
     return $data;
 }
Ejemplo n.º 2
0
 public static function prepare(array $data = array(), DocumentParser $modx, $_DL, prepare_DL_Extender $_extDocLister)
 {
     $imageField = $_DL->getCfgDef('imageField');
     $thumbOptions = $_DL->getCfgDef('thumbOptions');
     $thumbSnippet = $_DL->getCfgDef('thumbSnippet');
     if (!empty($thumbOptions) && !empty($thumbSnippet)) {
         $_thumbOptions = json_decode($thumbOptions, true);
         if (is_array($_thumbOptions)) {
             foreach ($_thumbOptions as $key => $value) {
                 $postfix = $key == 'default' ? '.' : '_' . $key . '.';
                 $data['thumb' . $postfix . $imageField] = $modx->runSnippet($thumbSnippet, array('input' => $data[$imageField], 'options' => $value));
                 $info = getimagesize(MODX_BASE_PATH . $data['thumb' . $postfix . $imageField]);
                 $data['thumb' . $postfix . 'width.' . $imageField] = $info[0];
                 $data['thumb' . $postfix . 'height.' . $imageField] = $info[1];
             }
         } else {
             $data['thumb.' . $imageField] = $modx->runSnippet($thumbSnippet, array('input' => $data[$imageField], 'options' => $thumbOptions));
         }
         $info = getimagesize(MODX_BASE_PATH . $data['thumb.' . $imageField]);
         $data['thumb.width.' . $imageField] = $info[0];
         $data['thumb.height.' . $imageField] = $info[1];
     }
     $properties = json_decode($data['sg_properties'], true);
     foreach ($properties as $key => $value) {
         $data['properties.' . $key] = $value;
     }
     return $data;
 }
Ejemplo n.º 3
0
 /**
  * Mailer constructor.
  * @param \DocumentParser $modx
  * @param $cfg
  * @param bool $debug
  */
 public function __construct(\DocumentParser $modx, $cfg, $debug = false)
 {
     $this->modx = $modx;
     $modx->loadExtension('MODxMailer');
     $this->mail = $modx->mail;
     $this->config = $cfg;
     $this->debug = $debug;
 }
Ejemplo n.º 4
0
 public static function prepare(array $data = array(), \DocumentParser $modx, $_DL, \prepare_DL_Extender $_extDocLister)
 {
     if (($data['parentName'] = $_extDocLister->getStore('parentName' . $data['parent'])) === null) {
         $q = $modx->db->query("SELECT pagetitle FROM " . $modx->getFullTableName('site_content') . " WHERE id = '" . $data['parent'] . "'");
         $data['parentName'] = $modx->db->getValue($q);
         $_extDocLister->setStore('parentName' . $data['parent'], $data['parentName']);
     }
     if (($docCrumbs = $_extDocLister->getStore('currentParents' . $data['parent'])) === null) {
         $modx->documentObject['id'] = $data['id'];
         $docCrumbs = rtrim($modx->runSnippet('DLcrumbs', array('ownerTPL' => '@CODE:[+crumbs.wrap+]', 'tpl' => '@CODE: [+title+] /', 'tplCurrent' => '@CODE: [+title+] /', 'hideMain' => '1')), ' /');
         $_extDocLister->setStore('currentParents' . $data['parent'], $docCrumbs);
     }
     $html = preg_replace("/(" . preg_quote($_DL->getCFGDef('search'), "/") . ")/iu", "<b>\$0</b>", $data['pagetitle']);
     $data['text'] = "{$data['id']}. {$data['pagetitle']}";
     $data['html'] = "<div><small>{$docCrumbs}</small><br>{$data['id']}. {$html}</div>";
     return $data;
 }
Ejemplo n.º 5
0
 /**
  * Генерация имени таблицы с префиксом и алиасом
  *
  * @param string $name имя таблицы
  * @param string $alias желаемый алиас таблицы
  * @return string имя таблицы с префиксом и алиасом
  */
 public function getTable($name, $alias = '')
 {
     if (!isset($this->_table[$name])) {
         $this->_table[$name] = $this->modx->getFullTableName($name);
     }
     $table = $this->_table[$name];
     if (!empty($alias) && is_scalar($alias)) {
         $table .= " as `" . $alias . "`";
     }
     return $table;
 }
Ejemplo n.º 6
0
 public static function buildMenu(array $data = array(), DocumentParser $modx, $_DL, prepare_DL_Extender $_eDL)
 {
     $params = $_DL->getCFGDef('params', array());
     if ($_DL->getCfgDef('currentDepth', 1) < $_DL->getCFGDef('maxDepth', 5)) {
         $params['currentDepth'] = $_DL->getCfgDef('currentDepth', 1) + 1;
         $params['parents'] = $data['id'];
         $params['idType'] = 'parents';
         $params['documents'] = '';
         $data['dl.submenu'] = $modx->runSnippet('DLBuildMenu', $params);
     } else {
         $data['dl.submenu'] = '';
     }
     $data['dl.currentDepth'] = $_DL->getCfgDef('currentDepth', 1);
     if (($parentIDs = $_eDL->getStore('parentIDs')) === null) {
         $parentIDs = array_values($modx->getParentIds($modx->documentObject['id']));
         $_eDL->setStore('parentIDs', $parentIDs);
     }
     $isActive = is_array($parentIDs) && in_array($data['id'], $parentIDs) || $data['id'] == $modx->documentObject['id'];
     $activeClass = $_DL->getCfgDef('activeClass', 'active');
     if ($isActive) {
         $data['dl.class'] .= ' ' . $activeClass;
     }
     if (strpos($data['dl.class'], 'current') !== false && strpos($data['dl.class'], ' ' . $activeClass) === false) {
         $data['dl.class'] = str_replace('current', 'current ' . $activeClass, $data['dl.class']);
     }
     $tpl = empty($data['dl.submenu']) ? 'noChildrenRowTPL' : 'mainRowTpl';
     $_DL->renderTPL = $_DL->getCfgDef($tpl);
     if (strpos($data['dl.class'], 'current') !== false) {
         $_DL->renderTPL = $_DL->getCfgDef('TplCurrent', $_DL->renderTPL);
         $_DL->renderTPL = $_DL->getCfgDef('TplCurrent' . $data['dl.currentDepth'], $_DL->renderTPL);
         if (empty($data['dl.submenu'])) {
             $_DL->renderTPL = $_DL->getCfgDef('TplCurrentNoChildren' . $data['dl.currentDepth'], $_DL->renderTPL);
         }
     }
     return $data;
 }
Ejemplo n.º 7
0
 function MODxAPI()
 {
     //$this->startSession();
     if (method_exists('DocumentParser', 'DocumentParser')) {
         parent::DocumentParser();
     } else {
         parent::__construct();
     }
     // set some parser options
     $this->minParserPasses = 1;
     // min number of parser recursive loops or passes
     $this->maxParserPasses = 10;
     // max number of parser recursive loops or passes
     $this->dumpSQL = false;
     $this->dumpSnippets = false;
     $this->getSettings();
     // set start time
     $this->tstart = $this->getMicroTime();
     // feed the parser the execution start time
 }
Ejemplo n.º 8
0
<?php

/**
 * This file includes slightly modified code from the MODx core distribution.
 */
require_once '../../../manager/includes/protect.inc.php';
include_once '../../../manager/includes/config.inc.php';
include_once MODX_BASE_PATH . 'manager/includes/document.parser.class.inc.php';
include_once MODX_BASE_PATH . 'assets/modules/docmanager/classes/docmanager.class.php';
$modx = new DocumentParser();
$modx->getSettings();
$dm = new DocManager($modx);
$dm->getLang();
$dm->getTheme();
$output = '';
if (isset($_POST['tplID']) && is_numeric($_POST['tplID'])) {
    $sql = "SELECT * FROM " . $modx->getFullTableName('site_tmplvars') . " tv LEFT JOIN " . $modx->getFullTableName('site_tmplvar_templates') . " ON tv.id = " . $modx->getFullTableName('site_tmplvar_templates') . ".tmplvarid WHERE " . $modx->getFullTableName('site_tmplvar_templates') . ".templateid ='" . $_POST['tplID'] . "'";
    $rs = $modx->db->query($sql);
    $limit = $modx->db->getRecordCount($rs);
    if ($limit > 0) {
        require MODX_BASE_PATH . '/manager/includes/tmplvars.commands.inc.php';
        $output .= "<table style='position:relative' border='0' cellspacing='0' cellpadding='3' width='96%'>";
        for ($i = 0; $i < $limit; $i++) {
            $row = $modx->db->getRow($rs);
            if ($i > 0 && $i < $limit) {
                $output .= '<tr><td colspan="2"><div class="split"></div></td></tr>';
            }
            $output .= '<tr style="height: 24px;">
				<td align="left" valign="top" width="150">
					<span class=\'warning\'>' . $row['caption'] . '</span><br /><span class=\'comment\'>' . $row['description'] . '</span>
				</td>
Ejemplo n.º 9
0
* @version      1.9.0
* @date         18/05/2010
*
*/
if (isset($_POST['search'])) {
    define('AS_VERSION', '1.9.0');
    define('AS_SPATH', 'assets/snippets/ajaxSearch/');
    define('AS_PATH', MODX_BASE_PATH . AS_SPATH);
    require_once MODX_MANAGER_PATH . '/includes/protect.inc.php';
    if (!isset($_POST['as_version']) || $_POST['as_version'] != AS_VERSION) {
        $output = "AjaxSearch version obsolete. <br />Please check the snippet code in MODx manager.";
    } else {
        include_once AS_PATH . "classes/ajaxSearch.class.inc.php";
        define('MODX_API_MODE', true);
        include_once MODX_MANAGER_PATH . '/includes/document.parser.class.inc.php';
        $modx = new DocumentParser();
        $modx->db->connect();
        $modx->getSettings();
        startCMSSession();
        $tstart = $modx->getMicroTime();
        $default = AS_PATH . 'configs/default.config.php';
        if (file_exists($default)) {
            include $default;
        } else {
            return "<h3>AjaxSearch error: {$default} not found !<br />Check the existing of this file!</h3>";
        }
        if (!isset($dcfg)) {
            return "<h3>AjaxSearch error: default configuration array not defined in {$default}!<br /> Check the content of this file!</h3>";
        }
        $ucfg = parseUserConfig($_POST['ucfg']);
        // Load the custom functions of the custom configuration file if needed
Ejemplo n.º 10
0
 private function _sendLogEvent($type, $message, $title = '')
 {
     $title = "DocLister" . (!empty($title) ? ' - ' . $title : '');
     $this->modx->logEvent(0, $type, $message, $title);
 }
 /**
  * Gathers annotation data from class.
  *
  * @param \ReflectionClass $reflectionClass Document reflection class to read mapping from.
  * @param array            $indexAnalyzers
  *
  * @return array
  */
 private function getDocumentReflectionMetadata(\ReflectionClass $reflectionClass, array $indexAnalyzers)
 {
     $metadata = $this->parser->parse($reflectionClass, $indexAnalyzers);
     return $metadata;
 }
Ejemplo n.º 12
0
 /**
  * build siteCache file
  * @param  DocumentParser $modx
  * @return boolean success
  */
 function buildCache($modx)
 {
     $tmpPHP = "<?php\n";
     // SETTINGS & DOCUMENT LISTINGS CACHE
     // get settings
     $sql = 'SELECT * FROM ' . $modx->getFullTableName('system_settings');
     $rs = $modx->db->query($sql);
     $limit_tmp = $modx->db->getRecordCount($rs);
     $config = array();
     $tmpPHP .= '$c=&$this->config;' . "\n";
     while (list($key, $value) = $modx->db->getRow($rs, 'num')) {
         $tmpPHP .= '$c[\'' . $key . '\']' . ' = "' . $this->escapeDoubleQuotes($value) . "\";\n";
         $config[$key] = $value;
     }
     // get aliases modx: support for alias path
     $tmpPath = '';
     $tmpPHP .= '$this->aliasListing = array();' . "\n";
     $tmpPHP .= '$a = &$this->aliasListing;' . "\n";
     $tmpPHP .= '$d = &$this->documentListing;' . "\n";
     $tmpPHP .= '$m = &$this->documentMap;' . "\n";
     $sql = 'SELECT IF(alias=\'\', id, alias) AS alias, id, contentType, parent FROM ' . $modx->getFullTableName('site_content') . ' WHERE deleted=0 ORDER BY parent, menuindex';
     $rs = $modx->db->query($sql);
     $limit_tmp = $modx->db->getRecordCount($rs);
     for ($i_tmp = 0; $i_tmp < $limit_tmp; $i_tmp++) {
         $tmp1 = $modx->db->getRow($rs);
         if ($config['friendly_urls'] == 1 && $config['use_alias_path'] == 1) {
             $tmpPath = $this->getParents($tmp1['parent']);
             $alias = (strlen($tmpPath) > 0 ? "{$tmpPath}/" : '') . $tmp1['alias'];
             $alias = $modx->db->escape($alias);
             $tmpPHP .= '$d[\'' . $alias . '\']' . " = " . $tmp1['id'] . ";\n";
         } else {
             $tmpPHP .= '$d[\'' . $modx->db->escape($tmp1['alias']) . '\']' . " = " . $tmp1['id'] . ";\n";
         }
         $tmpPHP .= '$a[' . $tmp1['id'] . ']' . " = array('id' => " . $tmp1['id'] . ", 'alias' => '" . $modx->db->escape($tmp1['alias']) . "', 'path' => '" . $modx->db->escape($tmpPath) . "', 'parent' => " . $tmp1['parent'] . ");\n";
         $tmpPHP .= '$m[]' . " = array('" . $tmp1['parent'] . "' => '" . $tmp1['id'] . "');\n";
     }
     // get content types
     $sql = 'SELECT id, contentType FROM ' . $modx->getFullTableName('site_content') . " WHERE contentType != 'text/html'";
     $rs = $modx->db->query($sql);
     $limit_tmp = $modx->db->getRecordCount($rs);
     $tmpPHP .= '$c = &$this->contentTypes;' . "\n";
     for ($i_tmp = 0; $i_tmp < $limit_tmp; $i_tmp++) {
         $tmp1 = $modx->db->getRow($rs);
         $tmpPHP .= '$c[' . $tmp1['id'] . ']' . " = '" . $tmp1['contentType'] . "';\n";
     }
     // WRITE Chunks to cache file
     $sql = 'SELECT * FROM ' . $modx->getFullTableName('site_htmlsnippets');
     $rs = $modx->db->query($sql);
     $limit_tmp = $modx->db->getRecordCount($rs);
     $tmpPHP .= '$c = &$this->chunkCache;' . "\n";
     for ($i_tmp = 0; $i_tmp < $limit_tmp; $i_tmp++) {
         $tmp1 = $modx->db->getRow($rs);
         $tmpPHP .= '$c[\'' . $modx->db->escape($tmp1['name']) . '\']' . " = '" . $this->escapeSingleQuotes($tmp1['snippet']) . "';\n";
     }
     // WRITE snippets to cache file
     $sql = 'SELECT ss.*,sm.properties as `sharedproperties` ' . 'FROM ' . $modx->getFullTableName('site_snippets') . ' ss ' . 'LEFT JOIN ' . $modx->getFullTableName('site_modules') . ' sm on sm.guid=ss.moduleguid';
     $rs = $modx->db->query($sql);
     $limit_tmp = $modx->db->getRecordCount($rs);
     $tmpPHP .= '$s = &$this->snippetCache;' . "\n";
     for ($i_tmp = 0; $i_tmp < $limit_tmp; $i_tmp++) {
         $tmp1 = $modx->db->getRow($rs);
         $tmpPHP .= '$s[\'' . $modx->db->escape($tmp1['name']) . '\']' . " = '" . $this->escapeSingleQuotes($tmp1['snippet']) . "';\n";
         // Raymond: save snippet properties to cache
         if ($tmp1['properties'] != "" || $tmp1['sharedproperties'] != "") {
             $tmpPHP .= '$s[\'' . $tmp1['name'] . 'Props\']' . " = '" . $this->escapeSingleQuotes($tmp1['properties'] . " " . $tmp1['sharedproperties']) . "';\n";
         }
         // End mod
     }
     // WRITE plugins to cache file
     $sql = 'SELECT sp.*,sm.properties as `sharedproperties`' . 'FROM ' . $modx->getFullTableName('site_plugins') . ' sp ' . 'LEFT JOIN ' . $modx->getFullTableName('site_modules') . ' sm on sm.guid=sp.moduleguid ' . 'WHERE sp.disabled=0';
     $rs = $modx->db->query($sql);
     $limit_tmp = $modx->db->getRecordCount($rs);
     $tmpPHP .= '$p = &$this->pluginCache;' . "\n";
     for ($i_tmp = 0; $i_tmp < $limit_tmp; $i_tmp++) {
         $tmp1 = $modx->db->getRow($rs);
         $tmpPHP .= '$p[\'' . $modx->db->escape($tmp1['name']) . '\']' . " = '" . $this->escapeSingleQuotes($tmp1['plugincode']) . "';\n";
         if ($tmp1['properties'] != '' || $tmp1['sharedproperties'] != '') {
             $tmpPHP .= '$p[\'' . $tmp1['name'] . 'Props\']' . " = '" . $this->escapeSingleQuotes($tmp1['properties'] . ' ' . $tmp1['sharedproperties']) . "';\n";
         }
     }
     // WRITE system event triggers
     $sql = 'SELECT sysevt.name as `evtname`, pe.pluginid, plugs.name
             FROM ' . $modx->getFullTableName('system_eventnames') . ' sysevt
             INNER JOIN ' . $modx->getFullTableName('site_plugin_events') . ' pe ON pe.evtid = sysevt.id
             INNER JOIN ' . $modx->getFullTableName('site_plugins') . ' plugs ON plugs.id = pe.pluginid
             WHERE plugs.disabled=0
             ORDER BY sysevt.name,pe.priority';
     $events = array();
     $rs = $modx->db->query($sql);
     $limit_tmp = $modx->db->getRecordCount($rs);
     $tmpPHP .= '$e = &$this->pluginEvent;' . "\n";
     for ($i = 0; $i < $limit_tmp; $i++) {
         $evt = $modx->db->getRow($rs);
         if (!$events[$evt['evtname']]) {
             $events[$evt['evtname']] = array();
         }
         $events[$evt['evtname']][] = $evt['name'];
     }
     foreach ($events as $evtname => $pluginnames) {
         $tmpPHP .= '$e[\'' . $evtname . '\'] = array(\'' . implode("','", $this->escapeSingleQuotes($pluginnames)) . "');\n";
     }
     // close and write the file
     $tmpPHP .= "\n";
     $filename = $this->cachePath . 'siteCache.idx.php';
     $somecontent = $tmpPHP;
     // invoke OnBeforeCacheUpdate event
     if ($modx) {
         $modx->invokeEvent('OnBeforeCacheUpdate');
     }
     if (!($handle = fopen($filename, 'w'))) {
         echo 'Cannot open file (', $filename, ')';
         exit;
     }
     // Write $somecontent to our opened file.
     if (fwrite($handle, $somecontent) === FALSE) {
         echo 'Cannot write main MODx cache file! Make sure the assets/cache directory is writable!';
         exit;
     }
     fclose($handle);
     // invoke OnCacheUpdate event
     if ($modx) {
         $modx->invokeEvent('OnCacheUpdate');
     }
     return true;
 }
Ejemplo n.º 13
0
{
    preg_match('/&config=`([^`]*)`/', $ucfg, $matches);
    return $matches[1];
}
if (isset($_POST['search'])) {
    define('AS_VERSION', '1.10.1');
    define('AS_SPATH', 'assets/snippets/ajaxSearch/');
    define('AS_PATH', MODX_BASE_PATH . AS_SPATH);
    require_once MODX_MANAGER_PATH . 'includes/protect.inc.php';
    if (!isset($_POST['as_version']) || strip_tags($_POST['as_version']) != AS_VERSION) {
        $output = "AjaxSearch version obsolete. <br />Please check the snippet code in MODX manager.";
    } else {
        include_once AS_PATH . "classes/ajaxSearch.class.inc.php";
        define('MODX_API_MODE', true);
        include_once MODX_MANAGER_PATH . 'includes/document.parser.class.inc.php';
        $modx = new DocumentParser();
        $modx->db->connect();
        $modx->getSettings();
        startCMSSession();
        $tstart = $modx->getMicroTime();
        $default = AS_PATH . 'configs/default.config.php';
        if (file_exists($default)) {
            include $default;
        } else {
            return "<h3>AjaxSearch error: {$default} not found !<br />Check the existing of this file!</h3>";
        }
        if (!isset($dcfg)) {
            return "<h3>AjaxSearch error: default configuration array not defined in {$default}!<br /> Check the content of this file!</h3>";
        }
        $config = getUserConfigName(strip_tags($_POST['ucfg']));
        // Load the custom functions of the custom configuration file if needed
Ejemplo n.º 14
0
<?php

include_once dirname(__FILE__) . "/../../../cache/siteManager.php";
require_once dirname(__FILE__) . '/../../../../' . MGR_DIR . '/includes/config.inc.php';
if (!defined('MODX_BASE_PATH')) {
    die('What are you doing? Get out of here!');
}
startCMSSession();
include_once MODX_MANAGER_PATH . '/includes/document.parser.class.inc.php';
$modx = new DocumentParser();
$modx->getSettings();
$txt = $_POST[txt];
// Приводим сниппеты к единному знаменателю
$txt = str_replace('!]', ']]', $txt);
$txt = str_replace('[!', '[[', $txt);
//Сниппеты
if (strpos($txt, '[[') > -1) {
    $matches = array();
    preg_match_all('~\\[\\[(.*?)\\]\\]~s', $txt, $matches);
    $snippets = array();
    foreach ($matches[1] as $snip) {
        $snipName = explode('?', $snip);
        $snippets[] = '"' . $snipName[0] . '"';
    }
    $snippets = array_unique($snippets);
    $tblSnip = $modx->getFullTableName('site_snippets');
    $sql = 'select `id`,`name` from ' . $tblSnip . ' where name in (' . implode(',', $snippets) . ') order by `name` asc';
    $res = $modx->db->query($sql);
    $out .= '<optgroup label=\'Сниппеты\'>';
    while ($row = $modx->db->getRow($res)) {
        echo 'index.php?id=".$row[id]."&a=22';
Ejemplo n.º 15
0
<?php

/**
 * This file includes slightly modified code from the MODX core distribution.
 */
include_once "../../cache/siteManager.php";
require_once '../../../' . MGR_DIR . '/includes/protect.inc.php';
include_once '../../../' . MGR_DIR . '/includes/config.inc.php';
include_once MODX_MANAGER_PATH . 'includes/document.parser.class.inc.php';
include_once MODX_BASE_PATH . 'assets/modules/docmanager/classes/docmanager.class.php';
$modx = new DocumentParser();
$modx->getSettings();
$dm = new DocManager($modx);
$dm->getLang();
$dm->getTheme();
$output = '';
if (isset($_POST['tplID']) && is_numeric($_POST['tplID'])) {
    $rs = $modx->db->select('*', $modx->getFullTableName('site_tmplvars') . " tv\n\t\t\tLEFT JOIN " . $modx->getFullTableName('site_tmplvar_templates') . " AS tvt ON tv.id = tvt.tmplvarid", "tvt.templateid ='{$_POST['tplID']}'");
    $limit = $modx->db->getRecordCount($rs);
    if ($limit > 0) {
        require MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php';
        $output .= "<table style='position:relative' border='0' cellspacing='0' cellpadding='3' width='96%'>";
        $i = 0;
        while ($row = $modx->db->getRow($rs)) {
            if ($i++ > 0) {
                $output .= '<tr><td colspan="2"><div class="split"></div></td></tr>';
            }
            $output .= '<tr style="height: 24px;">
				<td align="left" valign="top" width="200">
					<span class=\'warning\'><input type=\'checkbox\' name=\'update_tv_' . $row['id'] . '\' id=\'cb_update_tv_' . $row['id'] . '\' value=\'yes\' />&nbsp;' . $row['caption'] . '</span><br /><span class=\'comment\'>' . $row['description'] . '</span>
				</td>
Ejemplo n.º 16
0
    $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PATH_INFO"], "", preg_replace("/\\\\/", "/", $_SERVER["PATH_TRANSLATED"])) . "/";
}
define("IN_ETOMITE_SYSTEM", "true");
// for backward compatibility with 0.6
// include_once config file
$config_filename = "./includes/config.inc.php";
if (!file_exists($config_filename)) {
    echo "<h3>Unable to load configuration settings</h3>";
    echo "Please run the MODx <a href='../install'>install utility</a>";
    exit;
}
// include the database configuration file
include_once "config.inc.php";
// initiate the content manager class
include_once "document.parser.class.inc.php";
$modx = new DocumentParser();
$modx->loadExtension("ManagerAPI");
$modx->getSettings();
$etomite =& $modx;
// for backward compatibility
// connect to the database
if (@(!($modxDBConn = mysql_connect($database_server, $database_user, $database_password)))) {
    die("<h2>Failed to create the database connection!</h2>. Please run the MODx <a href='../install'>install utility</a>");
} else {
    mysql_select_db(str_replace('`', '', $dbase));
    @mysql_query("{$database_connection_method} {$database_connection_charset}");
}
// start session
startCMSSession();
// get the settings from the database
include_once "settings.inc.php";
Ejemplo n.º 17
0
$sortby = 'menuindex';
// Could be menuindex or menutitle
$limit = 0;
$recent = 0;
/* That's it to config! */
include_once dirname(__FILE__) . "/../../../cache/siteManager.php";
$tree_styles = array('|--', '&#9494;&nbsp;', '&#9658;&nbsp;', 'L&nbsp;');
define('MODX_API_MODE', true);
define("IN_MANAGER_MODE", "true");
$self = 'assets/plugins/tinymce/js/tinymce.linklist.php';
$base_path = str_replace($self, '', str_replace('\\', '/', __FILE__));
$mtime = microtime();
$manage_path = '../../../../' . MGR_DIR . '/';
include $manage_path . 'includes/config.inc.php';
include MODX_MANAGER_PATH . 'includes/document.parser.class.inc.php';
$modx = new DocumentParser();
$mtime = explode(" ", $mtime);
$modx->tstart = $mtime[1] + $mtime[0];
$modx->mstart = memory_get_usage();
startCMSSession();
$modx->db->connect();
$modx->getSettings();
/* only display if manager user is logged in */
if ($modx->getLoginUserType() !== 'manager') {
    // Make output a real JavaScript file!
    header('Content-type: application/x-javascript');
    // browser will now recognize the file as a valid JS file
    // prevent browser from caching
    header('pragma: no-cache');
    header('expires: 0');
    // i.e. contents have already expired
Ejemplo n.º 18
0
$base_url = '';
$base_path = '';
// get the required includes
if ($database_user == "") {
    $rt = @(include_once dirname(__FILE__) . '/' . MGR_DIR . '/includes/config.inc.php');
    // Be sure config.inc.php is there and that it contains some important values
    if (!$rt || !$database_type || !$database_server || !$database_user || !$dbase) {
        echo "\n<style type=\"text/css\">\n*{margin:0;padding:0}\nbody{margin:50px;background:#eee;}\n.install{padding:10px;border:5px solid #f22;background:#f99;margin:0 auto;font:120%/1em serif;text-align:center;}\np{ margin:20px 0; }\na{font-size:200%;color:#f22;text-decoration:underline;margin-top: 30px;padding: 5px;}\n</style>\n<div class=\"install\">\n<p>MODX is not currently installed or the configuration file cannot be found.</p>\n<p>Do you want to <a href=\"install/index.php\">install now</a>?</p>\n</div>";
        exit;
    }
}
// start session
startCMSSession();
// initiate a new document parser
include_once MODX_MANAGER_PATH . 'includes/document.parser.class.inc.php';
$modx = new DocumentParser();
$etomite =& $modx;
// for backward compatibility
// set some parser options
$modx->minParserPasses = 1;
// min number of parser recursive loops or passes
$modx->maxParserPasses = 10;
// max number of parser recursive loops or passes
$modx->dumpSQL = false;
$modx->dumpSnippets = false;
// feed the parser the execution start time
$modx->dumpPlugins = false;
$modx->tstart = $tstart;
$modx->mstart = $mstart;
// Debugging mode:
$modx->stopOnNotice = false;
Ejemplo n.º 19
0
    }
    if (!isset($lastInstallTime) || empty($lastInstallTime)) {
        if (is_file("{$base_path}install/index.php")) {
            header('Location: install/index.php?action=mode');
        } else {
            echo 'Not installed.';
        }
        exit;
    }
}
set_parser_mode();
if (session_id() === '') {
    startCMSSession();
}
require_once "{$core_path}protect.inc.php";
// initiate a new document parser
include_once "{$core_path}document.parser.class.inc.php";
$modx = new DocumentParser();
$etomite =& $modx;
// for backward compatibility
$modx->tstart = $tstart;
$modx->mstart = $mstart;
$modx->cacheRefreshTime = $cacheRefreshTime;
if (isset($error_reporting)) {
    $modx->error_reporting = $error_reporting;
}
// execute the parser if index.php was not included
if (!MODX_API_MODE) {
    $result = $modx->executeParser();
    echo $result;
}
    /**
     * build siteCache file
     * @param  DocumentParser $modx
     * @return boolean success
     */
    function buildCache($modx)
    {
        $tmpPHP = "<?php\n";
        // SETTINGS & DOCUMENT LISTINGS CACHE
        // get settings
        $rs = $modx->db->select('*', $modx->getFullTableName('system_settings'));
        $config = array();
        $tmpPHP .= '$c=&$this->config;' . "\n";
        while (list($key, $value) = $modx->db->getRow($rs, 'num')) {
            $tmpPHP .= '$c[\'' . $this->escapeSingleQuotes($key) . '\']' . ' = "' . $this->escapeDoubleQuotes($value) . "\";\n";
            $config[$key] = $value;
        }
        // get aliases modx: support for alias path
        $tmpPath = '';
        $tmpPHP .= '$this->aliasListing = array();' . "\n";
        $tmpPHP .= '$a = &$this->aliasListing;' . "\n";
        $tmpPHP .= '$d = &$this->documentListing;' . "\n";
        $tmpPHP .= '$m = &$this->documentMap;' . "\n";
        $rs = $modx->db->select('IF(alias=\'\', id, alias) AS alias, id, parent, isfolder', $modx->getFullTableName('site_content'), 'deleted=0', 'parent, menuindex');
        while ($tmp1 = $modx->db->getRow($rs)) {
            if ($config['friendly_urls'] == 1 && $config['use_alias_path'] == 1) {
                $tmpPath = $this->getParents($tmp1['parent']);
                $alias = (strlen($tmpPath) > 0 ? "{$tmpPath}/" : '') . $tmp1['alias'];
                $tmpPHP .= '$d[\'' . $this->escapeSingleQuotes($alias) . '\']' . " = " . $tmp1['id'] . ";\n";
            } else {
                $tmpPHP .= '$d[\'' . $this->escapeSingleQuotes($tmp1['alias']) . '\']' . " = " . $tmp1['id'] . ";\n";
            }
            $tmpPHP .= '$a[' . $tmp1['id'] . ']' . " = array('id' => " . $tmp1['id'] . ", 'alias' => '" . $this->escapeSingleQuotes($tmp1['alias']) . "', 'path' => '" . $this->escapeSingleQuotes($tmpPath) . "', 'parent' => " . $tmp1['parent'] . ", 'isfolder' => " . $tmp1['isfolder'] . ");\n";
            $tmpPHP .= '$m[]' . " = array('" . $tmp1['parent'] . "' => '" . $tmp1['id'] . "');\n";
        }
        // get content types
        $rs = $modx->db->select('id, contentType', $modx->getFullTableName('site_content'), "contentType != 'text/html'");
        $tmpPHP .= '$c = &$this->contentTypes;' . "\n";
        while ($tmp1 = $modx->db->getRow($rs)) {
            $tmpPHP .= '$c[' . $tmp1['id'] . ']' . " = '" . $this->escapeSingleQuotes($tmp1['contentType']) . "';\n";
        }
        // WRITE Chunks to cache file
        $rs = $modx->db->select('*', $modx->getFullTableName('site_htmlsnippets'));
        $tmpPHP .= '$c = &$this->chunkCache;' . "\n";
        while ($tmp1 = $modx->db->getRow($rs)) {
            $tmpPHP .= '$c[\'' . $this->escapeSingleQuotes($tmp1['name']) . '\']' . " = '" . $this->escapeSingleQuotes($tmp1['snippet']) . "';\n";
        }
        // WRITE snippets to cache file
        $rs = $modx->db->select('ss.*, sm.properties as sharedproperties', $modx->getFullTableName('site_snippets') . ' ss
				LEFT JOIN ' . $modx->getFullTableName('site_modules') . ' sm on sm.guid=ss.moduleguid');
        $tmpPHP .= '$s = &$this->snippetCache;' . "\n";
        while ($tmp1 = $modx->db->getRow($rs)) {
            $tmpPHP .= '$s[\'' . $this->escapeSingleQuotes($tmp1['name']) . '\']' . " = '" . $this->escapeSingleQuotes($tmp1['snippet']) . "';\n";
            if ($tmp1['properties'] != '' || $tmp1['sharedproperties'] != '') {
                $tmpPHP .= '$s[\'' . $this->escapeSingleQuotes($tmp1['name']) . 'Props\']' . " = '" . $this->escapeSingleQuotes($tmp1['properties'] . " " . $tmp1['sharedproperties']) . "';\n";
            }
        }
        // WRITE plugins to cache file
        $rs = $modx->db->select('sp.*, sm.properties as sharedproperties', $modx->getFullTableName('site_plugins') . ' sp
				LEFT JOIN ' . $modx->getFullTableName('site_modules') . ' sm on sm.guid=sp.moduleguid', 'sp.disabled=0');
        $tmpPHP .= '$p = &$this->pluginCache;' . "\n";
        while ($tmp1 = $modx->db->getRow($rs)) {
            $tmpPHP .= '$p[\'' . $this->escapeSingleQuotes($tmp1['name']) . '\']' . " = '" . $this->escapeSingleQuotes($tmp1['plugincode']) . "';\n";
            if ($tmp1['properties'] != '' || $tmp1['sharedproperties'] != '') {
                $tmpPHP .= '$p[\'' . $this->escapeSingleQuotes($tmp1['name']) . 'Props\']' . " = '" . $this->escapeSingleQuotes($tmp1['properties'] . ' ' . $tmp1['sharedproperties']) . "';\n";
            }
        }
        // WRITE system event triggers
        $events = array();
        $rs = $modx->db->select('sysevt.name as evtname, pe.pluginid, plugs.name', $modx->getFullTableName('system_eventnames') . ' sysevt
				INNER JOIN ' . $modx->getFullTableName('site_plugin_events') . ' pe ON pe.evtid = sysevt.id
				INNER JOIN ' . $modx->getFullTableName('site_plugins') . ' plugs ON plugs.id = pe.pluginid', 'plugs.disabled=0', 'sysevt.name,pe.priority');
        $tmpPHP .= '$e = &$this->pluginEvent;' . "\n";
        while ($evt = $modx->db->getRow($rs)) {
            if (!$events[$evt['evtname']]) {
                $events[$evt['evtname']] = array();
            }
            $events[$evt['evtname']][] = $evt['name'];
        }
        foreach ($events as $evtname => $pluginnames) {
            $tmpPHP .= '$e[\'' . $this->escapeSingleQuotes($evtname) . '\'] = array(\'' . implode("','", $this->escapeSingleQuotes($pluginnames)) . "');\n";
        }
        // close and write the file
        $tmpPHP .= "\n";
        $filename = $this->cachePath . 'siteCache.idx.php';
        $somecontent = $tmpPHP;
        // invoke OnBeforeCacheUpdate event
        if ($modx) {
            $modx->invokeEvent('OnBeforeCacheUpdate');
        }
        if (!($handle = fopen($filename, 'w'))) {
            echo 'Cannot open file (', $filename, ')';
            exit;
        }
        if (!is_file($this->cachePath . '/.htaccess')) {
            file_put_contents($this->cachePath . '/.htaccess', "order deny,allow\ndeny from all\n");
        }
        // Write $somecontent to our opened file.
        if (fwrite($handle, $somecontent) === FALSE) {
            echo 'Cannot write main MODX cache file! Make sure the assets/cache directory is writable!';
            exit;
        }
        fclose($handle);
        // invoke OnCacheUpdate event
        if ($modx) {
            $modx->invokeEvent('OnCacheUpdate');
        }
        return true;
    }
Ejemplo n.º 21
0
<?php

include_once "../../cache/siteManager.php";
require_once '../../../' . MGR_DIR . '/includes/protect.inc.php';
include_once '../../../' . MGR_DIR . '/includes/config.inc.php';
include_once MODX_MANAGER_PATH . 'includes/document.parser.class.inc.php';
$modx = new DocumentParser();
$modx->loadExtension("ManagerAPI");
$modx->getSettings();
// start session
startCMSSession();
$LoginUserID = $modx->getLoginUserID();
if (isset($_SESSION['mgrValidated']) or $LoginUserID !== NULL) {
    include_once $modx->config['base_path'] . 'assets/modules/easy_board/easy_board.config.php';
    include_once $modx->config['base_path'] . 'assets/modules/easy_board/easy_board.inc.php';
    $masterID = $modx->db->getValue($modx->db->select('createdby', $mod_table, "id=" . (int) $_GET[item_id]));
    // Формирование ответа для ajax запросов
    if (isset($_GET[act]) and ($masterID == $LoginUserID or isset($_SESSION['mgrValidated']))) {
        if ($_GET[act] == "delpic" and isset($_GET[item_id])) {
            delImage((int) $_GET[item_id], $mod_table);
            $fields = array('image' => "");
            $query = $modx->db->update($fields, $mod_table, "id = " . (int) $_GET[item_id]);
            die("<input name=\"image\" type=\"file\" />");
        }
        if ($_GET[act] == "unpub" and isset($_GET[item_id])) {
            $item_id = (int) $_GET[item_id];
            $fields = array('published' => 0);
            $query = $modx->db->update($fields, $mod_table, "id = {$item_id}");
            die('');
        }
    }
Ejemplo n.º 22
0
}
if (!defined('MGR_DIR') && is_dir($base_path . 'manager')) {
    define('MGR_DIR', 'manager');
}
// Include the nessesary files
define('MODX_MANAGER_PATH', $base_path . MGR_DIR . '/');
require_once MODX_MANAGER_PATH . 'includes/config.inc.php';
require_once MODX_MANAGER_PATH . 'includes/protect.inc.php';
// Setup the MODx API
define('MODX_API_MODE', true);
define('IN_MANAGER_MODE', true);
//start session
startCMSSession();
// initiate a new document parser
include_once MODX_MANAGER_PATH . '/includes/document.parser.class.inc.php';
$modx = new DocumentParser();
// provide the MODx DBAPI
$modx->db->connect();
// provide the $modx->documentMap and user settings
$modx->getSettings();
// set customtv (base) path
define('MTV_PATH', str_replace(MODX_BASE_PATH, '', str_replace('\\', '/', realpath(dirname(__FILE__)))) . '/');
define('MTV_BASE_PATH', MODX_BASE_PATH . MTV_PATH);
// include classfile
if (!class_exists('multiTV')) {
    include MTV_BASE_PATH . 'includes/multitv.class.php';
}
if (file_exists(MTV_BASE_PATH . 'languages/' . $modx->config['manager_language'] . '.language.inc.php')) {
    include MTV_BASE_PATH . 'languages/' . $modx->config['manager_language'] . '.language.inc.php';
} else {
    include MTV_BASE_PATH . 'languages/english.language.inc.php';
 function makeUrl($id, $alias = '', $args = '', $scheme = '')
 {
     $url = parent::makeUrl($id, $alias, $args, $scheme);
     if (strpos($url, '/') === 0) {
         // "/domainalias/folder/document.html"
         $url = substr($url, 1);
     }
     $parts = explode('/', $url);
     if ($parts[0] === $this->site->alias) {
         unset($parts[0]);
         $url = $this->config['base_url'] . implode('/', $parts);
     }
     if ($other_site = $this->sites['alias'][$parts[0]]) {
         $parts[0] = $other_site->protocol . $other_site->name;
         $url = implode('/', $parts);
     }
     return str_replace($this->site->alias . "/", "", $url);
 }
Ejemplo n.º 24
0
<?php

error_reporting(E_ALL & ~E_NOTICE);
define('MODX_BASE_PATH', realpath('../../../../') . '/');
include_once MODX_BASE_PATH . "assets/cache/siteManager.php";
define('MGR', MODX_BASE_PATH . MGR_DIR);
define('MODX_API_MODE', true);
include_once MGR . '/includes/config.inc.php';
include_once MGR . '/includes/document.parser.class.inc.php';
$modx = new DocumentParser();
$modx->db->connect();
$modx->getSettings();
startCMSSession();
$modx->minParserPasses = 2;
if (IN_MANAGER_MODE != 'true' && !$modx->hasPermission('exec_module')) {
    die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the MODX Content Manager instead of accessing this file directly.');
}
if (version_compare(phpversion(), "5.3") < 0) {
    @ini_set('magic_quotes_runtime', 0);
    @ini_set('magic_quotes_sybase', 0);
}
$moduleurl = $modx->config['site_url'] . 'assets/modules/store/installer/index.php';
$modulePath = MODX_BASE_PATH . 'assets/modules/store/installer/';
$self = $modulePath . '/index.php';
require_once $modulePath . "/functions.php";
$_lang = array();
$_params = array();
$lang = $modx->config['manager_language'];
if (file_exists($modulePath . '/lang/' . $lang . '.inc.php')) {
    include_once $modulePath . '/lang/' . $lang . '.inc.php';
} else {
Ejemplo n.º 25
0
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
$path_to_modx_config = '../../../manager/includes/config.inc.php';
include_once $path_to_modx_config;
startCMSSession();
include_once "../../../manager/includes/document.parser.class.inc.php";
$modx = new DocumentParser();
$modx->loadExtension("ManagerAPI");
$modx->getSettings();
$fileArray = array();
foreach ($_POST as $key => $value) {
    if ($key != 'folder') {
        $target_fname = $value;
        if ($modx->config['clean_uploaded_filename']) {
            $nameparts = explode('.', $target_fname);
            $nameparts = array_map(array($modx, 'stripAlias'), $nameparts);
            $target_fname = implode('.', $nameparts);
        }
        if (file_exists($_SERVER['DOCUMENT_ROOT'] . $_POST['folder'] . '/' . $target_fname)) {
            $fileArray[$key] = $value;
        }
    }
Ejemplo n.º 26
0
<?php

include_once dirname(__FILE__) . "/../../assets/cache/siteManager.php";
require_once strtr(realpath(dirname(__FILE__)), '\\', '/') . '/../includes/protect.inc.php';
set_include_path(get_include_path() . PATH_SEPARATOR . "../includes/");
define("IN_MANAGER_MODE", "true");
// we use this to make sure files are accessed through
// the manager instead of seperately.
// include the database configuration file
include_once "config.inc.php";
// start session
startCMSSession();
include_once "document.parser.class.inc.php";
$modx = new DocumentParser();
$modx->loadExtension("ManagerAPI");
$modx->getSettings();
$etomite =& $modx;
// get the settings from the database
include_once "settings.inc.php";
/*
 * include_once "version.inc.php"; //include version info. Use $modx->getVersionData()
 */
// include_once the language file
if (!isset($manager_language) || !file_exists(MODX_MANAGER_PATH . "includes/lang/" . $manager_language . ".inc.php")) {
    $manager_language = "english";
    // if not set, get the english language file.
}
$_lang = array();
include_once "lang/english.inc.php";
$length_eng_lang = count($_lang);
if ($manager_language != "english" && file_exists(MODX_MANAGER_PATH . "includes/lang/" . $manager_language . ".inc.php")) {
Ejemplo n.º 27
0
    $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PATH_INFO"], "", preg_replace("/\\\\/", "/", $_SERVER["PATH_TRANSLATED"])) . "/";
}
define("IN_ETOMITE_SYSTEM", "true");
// for backward compatibility with 0.6
// include_once config file
$config_filename = "./includes/config.inc.php";
if (!file_exists($config_filename)) {
    echo "<h3>Unable to load configuration settings</h3>";
    echo "Please run the MODX <a href='../install'>install utility</a>";
    exit;
}
// include the database configuration file
include_once "config.inc.php";
// initiate the content manager class
include_once "document.parser.class.inc.php";
$modx = new DocumentParser();
$modx->loadExtension("ManagerAPI");
$modx->getSettings();
$etomite =& $modx;
// for backward compatibility
$modx->tstart = $tstart;
$modx->mstart = $mstart;
// connect to the database
$modx->db->connect();
// start session
startCMSSession();
// get the settings from the database
include_once "settings.inc.php";
// get the user settings from the database
include_once "user_settings.inc.php";
// include_once the language file
Ejemplo n.º 28
0
include_once "version.inc.php";
// include the logger
include_once "log.class.inc.php";
// include the crypto thing
include_once "crypt.class.inc.php";
// Initialize System Alert Message Queque
if (!isset($_SESSION['SystemAlertMsgQueque'])) {
    $_SESSION['SystemAlertMsgQueque'] = array();
}
$SystemAlertMsgQueque =& $_SESSION['SystemAlertMsgQueque'];
// include_once the error handler
include_once "error.class.inc.php";
$e = new errorHandler();
// initiate the content manager class
include_once "document.parser.class.inc.php";
$modx = new DocumentParser();
$modx->loadExtension("ManagerAPI");
$modx->getSettings();
$etomite =& $modx;
// for backward compatibility
$username = $modx->db->escape($_REQUEST['username']);
$givenPassword = $modx->db->escape($_REQUEST['password']);
$captcha_code = $_REQUEST['captcha_code'];
$rememberme = $_REQUEST['rememberme'];
$failed_allowed = $modx->config["failed_login_attempts"];
// invoke OnBeforeManagerLogin event
$modx->invokeEvent("OnBeforeManagerLogin", array("username" => $username, "userpassword" => $givenPassword, "rememberme" => $rememberme));
$sql = "SELECT {$dbase}.`" . $table_prefix . "manager_users`.*, {$dbase}.`" . $table_prefix . "user_attributes`.* FROM {$dbase}.`" . $table_prefix . "manager_users`, {$dbase}.`" . $table_prefix . "user_attributes` WHERE BINARY {$dbase}.`" . $table_prefix . "manager_users`.username = '******' and {$dbase}.`" . $table_prefix . "user_attributes`.internalKey={$dbase}.`" . $table_prefix . "manager_users`.id;";
$rs = mysql_query($sql);
$limit = mysql_num_rows($rs);
if ($limit == 0 || $limit > 1) {
Ejemplo n.º 29
0
    function updateComment($logid, $ascmt)
    {
        global $modx;
        $fields['comment'] = $ascmt;
        $where = "id='" . $logid . "'";
        $modx->db->update($fields, $this->tbName, $where);
        return true;
    }
}
//==============================================================================
/* The code below handles comment sent if the $_POST variables are set. 
   Used when the user post comment from the ajaxSearch results window  */
if ($_POST['logid'] && $_POST['ascmt']) {
    $ascmt = $_POST['ascmt'];
    $logid = $_POST['logid'];
    $safeCmt = strlen($ascmt) < CMT_MAX_LENGTH && substr_count($ascmt, 'http') < CMT_MAX_LINKS;
    if ($ascmt != '' && $logid > 0 && $safeCmt) {
        // Setup the MODx API
        define('MODX_API_MODE', true);
        // initiate a new document parser
        include_once MODX_MANAGER_PATH . '/includes/document.parser.class.inc.php';
        $modx = new DocumentParser();
        $modx->db->connect();
        $modx->getSettings();
        $asLog = new AjaxSearchLog();
        $asLog->updateComment($logid, $ascmt);
        echo "comment about record " . $logid . " registered";
    } else {
        echo "ERROR: comment rejected";
    }
}
Ejemplo n.º 30
0
    include_once $richtextIncludeDirectory . 'assets/cache/siteManager.php';
}
if (!defined('MGR_DIR')) {
    define('MGR_DIR', 'manager');
}
$richtextIncludeDirectory .= MGR_DIR . '/';
//Config
$_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME'] = '/';
require_once $richtextIncludeDirectory . 'includes/protect.inc.php';
require_once $richtextIncludeDirectory . 'includes/config.inc.php';
startCMSSession();
if ($_SESSION['mgrValidated']) {
    define('IN_MANAGER_MODE', true);
    //Setup the MODx API
    define('MODX_API_MODE', true);
    //Initiate a new document parser
    require_once $richtextIncludeDirectory . 'includes/document.parser.class.inc.php';
    $modx = new DocumentParser();
    //Provide the MODx DBAPI
    $modx->db->connect();
    //Provide the $modx->documentMap and user settings
    $modx->getSettings();
    $mmDir = 'assets/plugins/managermanager/';
    $windowDir = $mmDir . 'widgets/ddmultiplefields/richtext/';
    //Include the ddTools library
    require_once $modx->config['base_path'] . $mmDir . 'modx.ddtools.class.php';
    $temp = $modx->invokeEvent('OnRichTextEditorInit', array('editor' => 'TinyMCE', 'elements' => array('ddMultipleFields_richtext')));
    echo ddTools::parseText(file_get_contents($modx->config['base_path'] . $windowDir . 'template.html'), array('site_url' => $modx->config['site_url'], 'mmDir' => $mmDir, 'windowDir' => $windowDir, 'charset' => '<meta charset="' . $modx->config['modx_charset'] . '" />', 'style' => MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/style.css', 'tinyMCE' => $temp[0]), '[+', '+]', false);
} else {
    echo file_get_contents(dirname(__FILE__) . '/index.html');
}