Example #1
0
function CKEditorGetConfigs($key = null)
{
    $tablename = TABLE_PREFIX . 'plugin_settings';
    try {
        $PDO = new PDO(DB_DSN, DB_USER, DB_PASS);
        if ($PDO->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') {
            $PDO->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
        }
    } catch (PDOException $error) {
        try {
            require_once substrtruncate($_SERVER['SCRIPT_FILENAME'], '/plugins') . '/libraries/DoLite.php';
            $PDO = new DoLite(DB_DSN, DB_USER, DB_PASS);
        } catch (PDOException $error) {
            die('DB Connection failed: ' . $error->getMessage());
        }
    }
    Record::connection($PDO);
    $PDO = Record::getConnection();
    $PDO->exec("set names 'utf8'");
    $sql = "SELECT name,value FROM {$tablename} WHERE plugin_id='ckeditor'";
    $settings = array();
    $stmt = $PDO->prepare($sql);
    $stmt->execute();
    while ($obj = $stmt->fetchObject()) {
        $settings[$obj->name] = $obj->value;
    }
    // language setting
    /**/
    AuthUser::load();
    $settings['editorLanguage'] = AuthUser::getRecord()->language;
    /**/
    if ($settings) {
        if ($key && in_array($key, $settings)) {
            return $settings[$key];
        } else {
            // return all
            return $settings;
        }
    }
    return false;
}
Example #2
0
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
function substrtruncate($string, $needle)
{
    return substr($string, 0, strrpos($string, $needle) + 1);
}
(include_once substrtruncate(dirname(__FILE__), '/plugins') . '../config.php') or die('TinyMCE plugin - unable to load Fresh CMS config file.');
(include_once substrtruncate(dirname(__FILE__), '/plugins') . '/Framework.php') or die('TinyMCE plugin - unable to load Framework.');
// Setup variables
$tablename = TABLE_PREFIX . 'plugin_settings';
// Fresh CMS plugin settings tablename.
$image_list_dir = '';
$image_public_path = 'undefined';
$preview_css = '';
$listhidden = 0;
$settings = array();
// Setup DB connection
try {
    $PDO = new PDO(DB_DSN, DB_USER, DB_PASS);
} catch (PDOException $error) {
    die('TinyMCE plugin - DB connection failed: ' . $error->getMessage());
}
if ($PDO->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') {