I am trying to integrate a basic CMS to my website, after three days solid working on it I am still having that ONE problem! I have tired everything I know, and did some research and found few answers but none actually solved the problem.
I used Firebug to check for bugs and errors, and the error that shows up is:
TypeError: $(...).dialog is not a function.
Click: function () { ${this}.dialog('close');window.location.reload();}
*Take a live look at it here: login using admin and pass, then when you are in the editor - try to click on one of the Edit Icons - it suppose to popup in a dialog / popup and not show in a new window like it currently does also the Close button shall be shown but it's not - I believe it is related to this error.
Hope my question is clear, if not please let me know which part and I will try to make it simpler, any help or advice would be much appropriated! I have been pulling my hair working on this and I am pletely new!
I will paste some of the codes below, but I have also uploaded the website files to be downloaded from here if needed (/?5jlxmp04cnf7ulw).
Frontend_js .php file:
<!--V.0.7-->
<div class="sce_hidden">
<div id="edit_mode">
<iframe src="#" style="width:100%; height:100%;" frameborder="0" name="sce_frame" id="sce_frame" scrolling="no"></iframe>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('.sce_edit_link_a, .sce_edit_link_short, .sce_image_link, .sce_file_link').click(function(){
link = $(this).attr('href');
$('#sce_frame').attr('src', link);
$( '#edit_mode' ).dialog({
height: 650,
width: 860,
modal: true,
resizable: true,
zIndex: 10000,
title: '<?php echo(lang_front_editmode); ?>',
buttons: [{
text: '<?php echo(lang_front_close); ?>',
click: function(){ $(this).dialog('close'); window.location.reload();}
}]
});
return false;
});
$('#sce_controlcenter').click(function(){
link = $(this).attr('href');
$('#sce_frame').attr('src', link);
$( '#edit_mode' ).dialog({
height: 600,
width: 800,
modal: true,
resizable: false,
zIndex: 10000,
title: '<?php echo(lang_front_cc); ?>',
buttons: [{
text: '<?php echo(lang_front_close); ?>',
click: function(){ $(this).dialog('close'); window.location.reload();}
}]
});
return false;
});
$('#sce_reloadpage').click(function(){
window.location.reload();
return false;
});
});
<?php
if($_GET['reload']=='yes'){
echo('window.location.href = \'//'. $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'].'\';');
}
?>
</script>
simpleCE .php file:
<?php /*V.0.7*/
defined('_parentFlag_') or die('ACCESS DENIED');
@error_reporting(0);
@ini_set('error_reporting', 0);
@ini_set('display_errors', 'Off');
if(defined('installMode')){
require_once('version.php');
}else{
require_once(sce_root.'/libraries/version.php');
}
class simpleCE extends Version{
static public $mysql = NULL;
static public $loopID = NULL;
static public $loops = NULL;
static public $loopI = NULL;
static public $pageBreak = NULL;
function __construct(){
global $mysql;
if( !defined('sce_folder') ){
define('sce_folder', 'simpleCE');
}
if(!defined('installMode')){
$mysql = mysql_connect(mysql_host, mysql_user, mysql_password) or die(mysql_errno().': '.mysql_error());
mysql_select_db(mysql_db) or die(mysql_errno().': '.mysql_error());
mysql_query ('set character_set_client=\'utf8\'');
mysql_query ('set character_set_results=\'utf8\'');
mysql_query ('set collation_connection=\'utf8_general_ci\'');
}
if(@file_exists(sce_root.'/lang/'.lang.'.php')){
require_once(sce_root.'/lang/'.lang.'.php');
}else{
if(@file_exists('../lang/'.lang.'.php')){
require_once('../lang/'.lang.'.php');
}else{
require_once('../lang/en.php');
}
}
}
function close(){
global $mysql;
@mysql_close($mysql);
}
function login($user='', $pw=''){
if(empty($user) || empty($pw)){
$user = $_COOKIE['sce_user'];
$pw = $_COOKIE['sce_password'];
}
if($user==username && $pw==password){
return(true);
}else{
return(false);
}
}
function footer(){
if($this->login()==true){
echo('<div id="sce_top_bar""><div id="sce_top_wrapper"><img class="logo" src="editor/images/loai-design-studio-logo2.png"/><ul><li><a href="'.root_url.'/'.sce_folder.'/controlcenter.php" id="sce_controlcenter">'.lang_controlcenter.'</a></li><li><a href="/?lang='.lang.'" target="_blank" id="sce_help">'.lang_help.'</a></li><li><a href="#" id="sce_reloadpage">'.lang_reload_page.'</a></li><li><a href="'.root_url.'/'.sce_folder.'/index.php?logout=true" id="sce_logout">'.lang_logout.'</a></li></ul></div></div>');
require_once(sce_root.'/frontend_js.php');
}
$this->close();
}
function head($jquery=true){
if(xhtml==true){
$xhtml = ' /';
}else{
$xhtml = '';
}
if($this->login()==true){
echo('<link rel="stylesheet" type="text/css" href="'.root_url.'/'.sce_folder.'/css/default-theme.css"'.$xhtml.'>'."\n");
echo('<script src="'.root_url.'/'.sce_folder.'/js/jquery.js"></script>'."\n");
echo('<script src="'.root_url.'/'.sce_folder.'/js/jquery-ui.js"></script>'."\n");
}else{
if( $colorbox == true ){
echo('<script src="'.root_url.'/'.sce_folder.'/js/jquery.js"></script>'."\n");
}elseif( $jquery == true ){
echo('<script src="'.root_url.'/'.sce_folder.'/js/jquery.js"></script>'."\n");
}
}
}
function systemPage(){
if($this->login()!=true){
header('Location: '.root_url.'/'.sce_folder.'/index.php');
}
}
function loopStart($id,$pageBreak=0){
global $loopID, $loops, $loopI,$pageBreak;
if($pageBreak <= 0 && $this->login()!=true){
$pageBreak = 0;
}else{
$pageBreak = $pageBreak;
}
$sql = 'SELECT * FROM `sce_loops` WHERE `loop_id` = '.$id.' LIMIT 0,1';
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
if($num_rows != 0){
$row = mysql_fetch_assoc($result);
mysql_free_result($result);
$loopI = 0;
$loops = $row['rows'];
$loopID = $row['loop_id'];
if($this->login()==true){
echo('<div class="sce_loop_start"><a href="'.root_url.'/'.sce_folder.'/loop.php?mode=add&id='.$row['id'].'" class="sce_add_loop">'.lang_add_row.'</a><br></div>');
}
}elseif($this->login()==true){
$sql = 'INSERT INTO `sce_loops` (`id`, `loop_id`, `rows`) VALUES (NULL, '.$id.', 1)';
mysql_query($sql) or die(mysql_errno().': '.mysql_error());
}
}
function loopController(){
global $loopID, $loops, $loopI,$pageBreak;
if($loopI>=$pageBreak && $this->login()!=true && $pageBreak>0){
return(false);
}
if($loopI >= $loops){
$loopID = NULL;
$loops = NULL;
$loopI = NULL;
return( false );
}else{
$loopI++;
return( true );
}
}
function loopStop(){
global $loopID, $loops, $loopI;
if($this->login()==true){
$moveLinks = '';
if($loopI!=1){
$moveLinks .= '<a href="'.root_url.'/'.sce_folder.'/loop.php?mode=up&id='.$loopID.'&row='.$loopI.'&placeholder='.($loops+1).'" class="sce_loop_up"></a>';
}
if($loopI!=$loops){
$moveLinks .= '<a href="'.root_url.'/'.sce_folder.'/loop.php?mode=down&id='.$loopID.'&row='.$loopI.'&placeholder='.($loops+1).'" class="sce_loop_down"></a>';
}
if($loopI==$loops){
$class = ' sce_loop_last';
}else{
$class= '';
}
echo('<div class="sce_loop_stop'.$class.'"><a href="'.root_url.'/'.sce_folder.'/loop.php?mode=del&id='.$loopID.'&row='.$loopI.'" class="sce_delete_loop">'.lang_row.' '.$loopI.' '.lang_delete.'</a>'.$moveLinks.'<br></div>');
}
}
function loopID($id){
global $loopID, $loops, $loopI;
if(!empty($loopID)){
return($id.$loopID);
}else{
return($id);
}
}
function isLoop(){
global $loopID, $loops, $loopI;
if(!empty($loopID)){
return(true);
}else{
return(false);
}
}
function saveText($id, $text, $mode){
$sql = 'UPDATE `sce_text` SET `text` = \''.mysql_real_escape_string($text).'\', `modified` = NOW() WHERE `id` = '.mysql_real_escape_string($id);
mysql_query($sql) or die(mysql_errno().': '.mysql_error());
}
function text($id,$mode='long', $options=false){
global $loopID, $loops, $loopI;
if($this->isLoop()){
$sql = 'SELECT * FROM `sce_text` WHERE `sce_id` = '.mysql_real_escape_string($id).' AND `loop_id` = '.mysql_real_escape_string($loopID).' AND `loop_row` = '.mysql_real_escape_string($loopI).' LIMIT 0,1';
}else{
$sql = 'SELECT * FROM `sce_text` WHERE `sce_id` = '.mysql_real_escape_string($id).' AND ( `loop_id` IS NULL OR `loop_id` = \'\' ) LIMIT 0,1';
}
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
if($num_rows != 0){
$row = mysql_fetch_assoc($result);
mysql_free_result($result);
$text = stripslashes($row['text']);
if($mode=='long' || $mode=='short'){
$text = nl2br($text);
if(xhtml!=true){
$text = str_replace('<br />', '<br>', $text);
}
}
if(xhtml==true){
$xhtml = ' /';
}else{
$xhtml = '';
}
if($this->login()==true){
if($mode=='long' || $mode=='editor'){
echo '<div class="sce_text"><div class="sce_edit_link"><a href="'.root_url.'/'.sce_folder.'/text.php?mode='.$mode.'&id='.$row['id'].'" class="sce_edit_link_a">'.lang_edit_content.'</a></div><div class="sce_content">'.$options['before'].$text.$options['after'].'</div></div>';
}else{
echo $options['before'].'<a href="'.root_url.'/'.sce_folder.'/text.php?mode='.$mode.'&id='.$row['id'].'" class="sce_edit_link_short"><img src="'.root_url.'/'.sce_folder.'/images/page_edit.png" width="16" height="16" border="0"'.$xhtml.'></a> '.$text.$options['after'];
}
}else{
$text = trim($text);
if(!empty($text)){
echo $options['before'].$text.$options['after'];
}
}
}elseif($this->login()==true){
if($this->isLoop()){
$sql = 'INSERT INTO `sce_text` (`id`, `sce_id`, `text`, `loop_id`, `loop_row`, `created`, `modified`) VALUES (NULL, '.mysql_real_escape_string($id).', \'\', '.mysql_real_escape_string($loopID).', '.mysql_real_escape_string($loopI).', NOW(), NOW())';
}else{
$sql = 'INSERT INTO `sce_text` (`id`, `sce_id`, `text`, `created`, `modified`) VALUES (NULL, '.mysql_real_escape_string($id).', \'\', NOW(), NOW())';
}
mysql_query($sql) or die(mysql_errno().': '.mysql_error());
}
}
function image($id, $options=NULL){
global $loopID, $loops, $loopI;
if($this->isLoop()){
$sql = 'SELECT * FROM `sce_images` WHERE `sce_id` = '.mysql_real_escape_string($id).' AND `loop_id` = '.mysql_real_escape_string($loopID).' AND `loop_row` = '.mysql_real_escape_string($loopI).' LIMIT 0,1';
}else{
$sql = 'SELECT * FROM `sce_images` WHERE `sce_id` = '.mysql_real_escape_string($id).' AND ( `loop_id` IS NULL OR `loop_id` = \'\' ) LIMIT 0,1';
}
if(xhtml==true){
$xhtml = ' /';
}else{
$xhtml = '';
}
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
if($num_rows != 0){
$row = mysql_fetch_assoc($result);
mysql_free_result($result);
if($row['path']){
if($row['link']){
$aBefore = '<a href="'.stripslashes($row['link']).'" target="'.$options['target'].'" class="'.$options['link_class'].'" title="'.stripslashes($row['alt']).'">';
$aAfter = '</a>';
}else{
$aBefore = '';
$aAfter = '';
}
if($row['lightbox']==1){
if(!$options['lightbox']){
$options['lightbox'] = 'lightbox';
}
$aBefore = '<a href="'.root_url.'/'.sce_folder.stripslashes($row['path']).'" rel="lightbox" class="'.$options['link_class'].'" title="'.stripslashes($row['alt']).'">';
$aAfter = '</a>';
}
if($options['phpThumb']){
$phpThumb = '&'.$options['phpThumb'];
}else{
$phpThumb = '';
}
$imgTag = $aBefore.'<img src="'.root_url.'/'.sce_folder.'/libraries/phpThumb.php?src=..'.stripslashes($row['path']).$phpThumb.'" alt="'.stripslashes($row['alt']).'" title="'.stripslashes($row['alt']).'" class="'.$options['img_class'].'"'.$xhtml.'>'.$aAfter;
}else{
$imgTag = '';
}
if($this->login()==true){
echo '<div class="sce_image"><div class="sce_link_box"><a href="'.root_url.'/'.sce_folder.'/upload.php?mode=image&id='.$row['id'].'" class="sce_image_link">'.lang_edit_image.'</a></div><div class="sce_content">'.$imgTag.'</div></div>';
}else{
echo($imgTag);
}
}elseif($this->login()==true){
if($this->isLoop()){
$sql = 'INSERT INTO `sce_images` (`id`, `sce_id`, `path`, `alt`, `link`, `lightbox`, `loop_id`, `loop_row`) VALUES (\'\', '.mysql_real_escape_string($id).', \'\', \'\', NULL, NULL, '.mysql_real_escape_string($loopID).', '.mysql_real_escape_string($loopI).')';
}else{
$sql = 'INSERT INTO `sce_images` (`id`, `sce_id`, `path`, `alt`, `link`, `lightbox`, `loop_id`, `loop_row`) VALUES (\'\', '.mysql_real_escape_string($id).', \'\', \'\', NULL, NULL, NULL, NULL)';
}
mysql_query($sql) or die(mysql_errno().': '.mysql_error());
}
}
function file($id, $options=NULL){
global $loopID, $loops, $loopI;
if($this->isLoop()){
$sql = 'SELECT * FROM `sce_files` WHERE `sce_id` = '.mysql_real_escape_string($id).' AND `loop_id` = '.mysql_real_escape_string($loopID).' AND `loop_row` = '.mysql_real_escape_string($loopI).' LIMIT 0,1';
}else{
$sql = 'SELECT * FROM `sce_files` WHERE `sce_id` = '.mysql_real_escape_string($id).' AND ( `loop_id` IS NULL OR `loop_id` = \'\' ) LIMIT 0,1';
}
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
if($num_rows != 0){
$row = mysql_fetch_assoc($result);
mysql_free_result($result);
if($row['path']){
if($options['target']){
$target = ' target="'.$options['target'].'"';
}else{
$target = '';
}
if($options['class']){
$class = ' class="'.$options['class'].'"';
}else{
$class = '';
}
if($options['id']){
$aid = ' id="'.$options['id'].'"';
}else{
$aid = '';
}
$fileLink = '<a href="'.root_url.'/'.sce_folder.$row['path'].'"'.$target.$class.$aid.' title="'.$row['text'].'">'.$row['text'].'</a>';
$editText = '';
}else{
$fileLink = '';
$editText = lang_upload_file;
}
if($this->login()==true){
echo '<div class="sce_file"><a href="'.root_url.'/'.sce_folder.'/upload.php?mode=file&id='.$row['id'].'" class="sce_file_link">'.$editText.'</a>'.$fileLink.'</div>';
}else{
echo($fileLink);
}
}elseif($this->login()==true){
if($this->isLoop()){
$sql = 'INSERT INTO `sce_files` (`id`, `sce_id`, `path`, `text`, `loop_id`, `loop_row`) VALUES (\'\', '.mysql_real_escape_string($id).', \'\', \'\', '.mysql_real_escape_string($loopID).', '.mysql_real_escape_string($loopI).')';
}else{
$sql = 'INSERT INTO `sce_files` (`id`, `sce_id`, `path`, `text`, `loop_id`, `loop_row`) VALUES (\'\', '.mysql_real_escape_string($id).', \'\', \'\', NULL, NULL)';
}
mysql_query($sql) or die(mysql_errno().': '.mysql_error());
}
}
function newsLoop($options){
if(empty($options['show']) || !is_numeric($options['show'])){
$options['show'] = 3;
}
if( strtolower($options['order']) != 'asc' || strtolower($options['order']) != 'desc' ){
$options['order'] = 'ASC';
}
if($options['headlineID']){
$headlineSQL = ' OR `sce_id`='.$options['headlineID'];
$options['show'] = $options['show']*2;
}else{
$headlineSQL = '';
}
$sql = 'SELECT * FROM `sce_text` WHERE `loop_id`='.$options['loopID'].' AND (`sce_id`='.$options['textID'].$headlineSQL.') ORDER BY `loop_row` '.$options['order'].' LIMIT 0,'.$options['show'];
$result = mysql_query($sql);
while( $row=mysql_fetch_assoc($result) ){
switch ($row['sce_id']){
case $options['textID']:
$row['text'] = preg_replace("/^[^a-z0-9]?(.*?)[^a-z0-9]?$/i", "$1", $row['text']);
echo($options['textBefore'].substr($row['text'], 0, $options['textTrim']).'...'.$options['readMoreLink'].$options['textAfter']);
break;
case $options['headlineID']:
$row['text'] = preg_replace("/^[^a-z0-9]?(.*?)[^a-z0-9]?$/i", "$1", $row['text']);
echo($options['headlineBefore'].substr($row['text'], 0, $options['headlineTrim']).$options['headlineAfter']);
break;
}
}
}
function getExtension($str) {
$i = strrpos($str,'.');
if (!$i) { return ''; }
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
return $ext;
}
function countTableEntries($table,$countEmpty=false){
if($countEmpty==false){
$sql = 'SELECT * FROM `'.mysql_real_escape_string($table).'`';
}else{
$sql = 'SELECT * FROM `'.mysql_real_escape_string($table).'` WHERE `'.mysql_real_escape_string($countEmpty).'` = \'\' OR `'.mysql_real_escape_string($countEmpty).'` IS NULL';
}
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
return($num_rows);
}
function dbStatus(){
$AllEntries = $this->countTableEntries('sce_text') + $this->countTableEntries('sce_images') + $this->countTableEntries('sce_files');
$EmptyEntries = $this->countTableEntries('sce_text', 'text') + $this->countTableEntries('sce_images', 'path') + $this->countTableEntries('sce_files', 'path');
$percent = @round( ($EmptyEntries / $AllEntries) * 100 );
return($percent);
}
function dbOptimize(){
$sql = 'DELETE FROM `sce_text` WHERE `text` = \'\' OR `text` IS NULL';
$sql2 = 'OPTIMIZE TABLE `sce_text`';
mysql_query($sql);
mysql_query($sql2);
$sql = 'DELETE FROM `sce_files` WHERE `path` = \'\' OR `text` IS NULL';
$sql2 = 'OPTIMIZE TABLE `sce_files`';
mysql_query($sql);
mysql_query($sql2);
$sql = 'DELETE FROM `sce_images` WHERE `path` = \'\' OR `text` IS NULL';
$sql2 = 'OPTIMIZE TABLE `sce_images`';
mysql_query($sql);
mysql_query($sql2);
}
function actURL(){
$url = (isset($_SERVER['HTTPS'])?'https':'http').'://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']);
$url = str_ireplace('/'.sce_folder.'/setup', '', $url);
return($url);
}
function actPath(){
$path = dirname(__FILE__);
$path = str_ireplace('/libraries', '', $path);
return($path);
}
function checkPermissions(){
$config = '../config.php';
$uploads = '../uploads/';
$uploadsC = '../uploads/cache/';
if(version_pare(PHP_VERSION, '5.1.0') >= 0){
$output = '<span class="green">» PHP-Version: '.phpversion().'</span><br>';
}else{
$output = '<span class="red">» PHP-Version: '.phpversion().'</span><br>';
}
if(is_writable($config)){
$output .= '<span class="green">» '.lang_setup_permissions_config_good.'</span><br>';
}else{
$output .= '<span class="red">» '.lang_setup_permissions_config_bad.'</span><br>';
}
if(is_writable($uploads)){
$output .= '<span class="green">» '.lang_setup_permissions_uploads_good.'</span><br>';
}else{
$output .= '<span class="red">» '.lang_setup_permissions_uploads_bad.'</span><br>';
}
if(is_writable($uploadsC)){
$output .= '<span class="green">» '.lang_setup_permissions_uploads_cache_good.'</span><br>';
}else{
$output .= '<span class="red">» '.lang_setup_permissions_uploads_cache_bad.'</span><br>';
}
return($output);
}
function createConfig($data){
$confTemplate = '../config.example.php';
$loadConfigTemplate = file_get_contents($confTemplate) or die('Can\'t load: '.$confTemplate);
$username = $data['username'];
$password = $data['password'];
$url = $data['url'];
$path = $data['path'];
$lang = $data['lang'];
$sql_server = $data['sql_server'];
$sql_username = $data['sql_username'];
$sql_password = $data['sql_password'];
$sql_db = $data['sql_db'];
if($data['html']=='html'){
$html = 'false';
}else{
$html = 'true';
}
if(
!empty($username) &&
!empty($password) &&
!empty($url) &&
!empty($path) &&
!empty($sql_server) &&
!empty($sql_username) &&
!empty($sql_db) &&
!empty($html)
){
$loadConfigTemplate = str_replace('MYSQL_HOST', $sql_server, $loadConfigTemplate);
$loadConfigTemplate = str_replace('MYSQL_DATABASE', $sql_db, $loadConfigTemplate);
$loadConfigTemplate = str_replace('MYSQL_USER', $sql_username, $loadConfigTemplate);
$loadConfigTemplate = str_replace('MYSQL_PW', $sql_password, $loadConfigTemplate);
$loadConfigTemplate = str_replace('FRONTEND_URL', $url, $loadConfigTemplate);
$loadConfigTemplate = str_replace('XHTML_SETTING', $html, $loadConfigTemplate);
$loadConfigTemplate = str_replace('SIMPLECE_PATH', $path, $loadConfigTemplate);
$loadConfigTemplate = str_replace('SIMPLECE_FOLDER', 'simpleCE', $loadConfigTemplate);
$loadConfigTemplate = str_replace('SIMPLECE_LANG', $lang, $loadConfigTemplate);
$loadConfigTemplate = str_replace('SIMPLECE_USER', $username, $loadConfigTemplate);
$loadConfigTemplate = str_replace('SIMPLECE_PW', md5($password), $loadConfigTemplate);
$fp = fopen('../config.php', 'w+') or die('Can\'t open / create config.php!');
fwrite($fp, $loadConfigTemplate);
fclose ($fp);
return(60);
}else{
return('Please fill out all fields in the form!');
}
}
function installDB(){
$sce_files = '
CREATE TABLE sce_files (
id int(11) NOT NULL auto_increment,
sce_id int(11) NOT NULL,
path varchar(500) NOT NULL,
`text` varchar(200) NOT NULL,
loop_id int(11) default NULL,
loop_row int(11) default NULL,
PRIMARY KEY (id)
) DEFAULT CHARSET=utf8;';
$sce_images = '
CREATE TABLE sce_images (
id int(11) NOT NULL auto_increment,
sce_id int(11) NOT NULL,
path varchar(400) NOT NULL,
alt varchar(200) NOT NULL,
link varchar(400) default NULL,
lightbox int(11) default NULL,
loop_id int(11) default NULL,
loop_row int(11) default NULL,
PRIMARY KEY (id)
) DEFAULT CHARSET=utf8;';
$sce_loops = '
CREATE TABLE sce_loops (
id int(11) NOT NULL auto_increment,
loop_id int(11) NOT NULL,
`rows` int(11) NOT NULL,
PRIMARY KEY (id)
) DEFAULT CHARSET=utf8;';
$sce_text = '
CREATE TABLE sce_text (
id int(11) NOT NULL auto_increment,
sce_id int(11) NOT NULL,
`text` text NOT NULL,
loop_id int(11) default NULL,
loop_row int(11) default NULL,
created datetime NOT NULL,
modified datetime NOT NULL,
PRIMARY KEY (id)
) DEFAULT CHARSET=utf8;';
if(
mysql_query($sce_files) &&
mysql_query($sce_images) &&
mysql_query($sce_loops) &&
mysql_query($sce_text)
){
return(100);
}else{
return(mysql_errno().': '.mysql_error());
}
}
}
$simpleCE = new simpleCE();
?>
I am trying to integrate a basic CMS to my website, after three days solid working on it I am still having that ONE problem! I have tired everything I know, and did some research and found few answers but none actually solved the problem.
I used Firebug to check for bugs and errors, and the error that shows up is:
TypeError: $(...).dialog is not a function.
Click: function () { ${this}.dialog('close');window.location.reload();}
*Take a live look at it here: http://codysilverkin./editor login using admin and pass, then when you are in the editor - try to click on one of the Edit Icons - it suppose to popup in a dialog / popup and not show in a new window like it currently does also the Close button shall be shown but it's not - I believe it is related to this error.
Hope my question is clear, if not please let me know which part and I will try to make it simpler, any help or advice would be much appropriated! I have been pulling my hair working on this and I am pletely new!
I will paste some of the codes below, but I have also uploaded the website files to be downloaded from here if needed (http://www.mediafire./?5jlxmp04cnf7ulw).
Frontend_js .php file:
<!--V.0.7-->
<div class="sce_hidden">
<div id="edit_mode">
<iframe src="#" style="width:100%; height:100%;" frameborder="0" name="sce_frame" id="sce_frame" scrolling="no"></iframe>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('.sce_edit_link_a, .sce_edit_link_short, .sce_image_link, .sce_file_link').click(function(){
link = $(this).attr('href');
$('#sce_frame').attr('src', link);
$( '#edit_mode' ).dialog({
height: 650,
width: 860,
modal: true,
resizable: true,
zIndex: 10000,
title: '<?php echo(lang_front_editmode); ?>',
buttons: [{
text: '<?php echo(lang_front_close); ?>',
click: function(){ $(this).dialog('close'); window.location.reload();}
}]
});
return false;
});
$('#sce_controlcenter').click(function(){
link = $(this).attr('href');
$('#sce_frame').attr('src', link);
$( '#edit_mode' ).dialog({
height: 600,
width: 800,
modal: true,
resizable: false,
zIndex: 10000,
title: '<?php echo(lang_front_cc); ?>',
buttons: [{
text: '<?php echo(lang_front_close); ?>',
click: function(){ $(this).dialog('close'); window.location.reload();}
}]
});
return false;
});
$('#sce_reloadpage').click(function(){
window.location.reload();
return false;
});
});
<?php
if($_GET['reload']=='yes'){
echo('window.location.href = \'//'. $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'].'\';');
}
?>
</script>
simpleCE .php file:
<?php /*V.0.7*/
defined('_parentFlag_') or die('ACCESS DENIED');
@error_reporting(0);
@ini_set('error_reporting', 0);
@ini_set('display_errors', 'Off');
if(defined('installMode')){
require_once('version.php');
}else{
require_once(sce_root.'/libraries/version.php');
}
class simpleCE extends Version{
static public $mysql = NULL;
static public $loopID = NULL;
static public $loops = NULL;
static public $loopI = NULL;
static public $pageBreak = NULL;
function __construct(){
global $mysql;
if( !defined('sce_folder') ){
define('sce_folder', 'simpleCE');
}
if(!defined('installMode')){
$mysql = mysql_connect(mysql_host, mysql_user, mysql_password) or die(mysql_errno().': '.mysql_error());
mysql_select_db(mysql_db) or die(mysql_errno().': '.mysql_error());
mysql_query ('set character_set_client=\'utf8\'');
mysql_query ('set character_set_results=\'utf8\'');
mysql_query ('set collation_connection=\'utf8_general_ci\'');
}
if(@file_exists(sce_root.'/lang/'.lang.'.php')){
require_once(sce_root.'/lang/'.lang.'.php');
}else{
if(@file_exists('../lang/'.lang.'.php')){
require_once('../lang/'.lang.'.php');
}else{
require_once('../lang/en.php');
}
}
}
function close(){
global $mysql;
@mysql_close($mysql);
}
function login($user='', $pw=''){
if(empty($user) || empty($pw)){
$user = $_COOKIE['sce_user'];
$pw = $_COOKIE['sce_password'];
}
if($user==username && $pw==password){
return(true);
}else{
return(false);
}
}
function footer(){
if($this->login()==true){
echo('<div id="sce_top_bar""><div id="sce_top_wrapper"><img class="logo" src="editor/images/loai-design-studio-logo2.png"/><ul><li><a href="'.root_url.'/'.sce_folder.'/controlcenter.php" id="sce_controlcenter">'.lang_controlcenter.'</a></li><li><a href="http://help.simplece./?lang='.lang.'" target="_blank" id="sce_help">'.lang_help.'</a></li><li><a href="#" id="sce_reloadpage">'.lang_reload_page.'</a></li><li><a href="'.root_url.'/'.sce_folder.'/index.php?logout=true" id="sce_logout">'.lang_logout.'</a></li></ul></div></div>');
require_once(sce_root.'/frontend_js.php');
}
$this->close();
}
function head($jquery=true){
if(xhtml==true){
$xhtml = ' /';
}else{
$xhtml = '';
}
if($this->login()==true){
echo('<link rel="stylesheet" type="text/css" href="'.root_url.'/'.sce_folder.'/css/default-theme.css"'.$xhtml.'>'."\n");
echo('<script src="'.root_url.'/'.sce_folder.'/js/jquery.js"></script>'."\n");
echo('<script src="'.root_url.'/'.sce_folder.'/js/jquery-ui.js"></script>'."\n");
}else{
if( $colorbox == true ){
echo('<script src="'.root_url.'/'.sce_folder.'/js/jquery.js"></script>'."\n");
}elseif( $jquery == true ){
echo('<script src="'.root_url.'/'.sce_folder.'/js/jquery.js"></script>'."\n");
}
}
}
function systemPage(){
if($this->login()!=true){
header('Location: '.root_url.'/'.sce_folder.'/index.php');
}
}
function loopStart($id,$pageBreak=0){
global $loopID, $loops, $loopI,$pageBreak;
if($pageBreak <= 0 && $this->login()!=true){
$pageBreak = 0;
}else{
$pageBreak = $pageBreak;
}
$sql = 'SELECT * FROM `sce_loops` WHERE `loop_id` = '.$id.' LIMIT 0,1';
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
if($num_rows != 0){
$row = mysql_fetch_assoc($result);
mysql_free_result($result);
$loopI = 0;
$loops = $row['rows'];
$loopID = $row['loop_id'];
if($this->login()==true){
echo('<div class="sce_loop_start"><a href="'.root_url.'/'.sce_folder.'/loop.php?mode=add&id='.$row['id'].'" class="sce_add_loop">'.lang_add_row.'</a><br></div>');
}
}elseif($this->login()==true){
$sql = 'INSERT INTO `sce_loops` (`id`, `loop_id`, `rows`) VALUES (NULL, '.$id.', 1)';
mysql_query($sql) or die(mysql_errno().': '.mysql_error());
}
}
function loopController(){
global $loopID, $loops, $loopI,$pageBreak;
if($loopI>=$pageBreak && $this->login()!=true && $pageBreak>0){
return(false);
}
if($loopI >= $loops){
$loopID = NULL;
$loops = NULL;
$loopI = NULL;
return( false );
}else{
$loopI++;
return( true );
}
}
function loopStop(){
global $loopID, $loops, $loopI;
if($this->login()==true){
$moveLinks = '';
if($loopI!=1){
$moveLinks .= '<a href="'.root_url.'/'.sce_folder.'/loop.php?mode=up&id='.$loopID.'&row='.$loopI.'&placeholder='.($loops+1).'" class="sce_loop_up"></a>';
}
if($loopI!=$loops){
$moveLinks .= '<a href="'.root_url.'/'.sce_folder.'/loop.php?mode=down&id='.$loopID.'&row='.$loopI.'&placeholder='.($loops+1).'" class="sce_loop_down"></a>';
}
if($loopI==$loops){
$class = ' sce_loop_last';
}else{
$class= '';
}
echo('<div class="sce_loop_stop'.$class.'"><a href="'.root_url.'/'.sce_folder.'/loop.php?mode=del&id='.$loopID.'&row='.$loopI.'" class="sce_delete_loop">'.lang_row.' '.$loopI.' '.lang_delete.'</a>'.$moveLinks.'<br></div>');
}
}
function loopID($id){
global $loopID, $loops, $loopI;
if(!empty($loopID)){
return($id.$loopID);
}else{
return($id);
}
}
function isLoop(){
global $loopID, $loops, $loopI;
if(!empty($loopID)){
return(true);
}else{
return(false);
}
}
function saveText($id, $text, $mode){
$sql = 'UPDATE `sce_text` SET `text` = \''.mysql_real_escape_string($text).'\', `modified` = NOW() WHERE `id` = '.mysql_real_escape_string($id);
mysql_query($sql) or die(mysql_errno().': '.mysql_error());
}
function text($id,$mode='long', $options=false){
global $loopID, $loops, $loopI;
if($this->isLoop()){
$sql = 'SELECT * FROM `sce_text` WHERE `sce_id` = '.mysql_real_escape_string($id).' AND `loop_id` = '.mysql_real_escape_string($loopID).' AND `loop_row` = '.mysql_real_escape_string($loopI).' LIMIT 0,1';
}else{
$sql = 'SELECT * FROM `sce_text` WHERE `sce_id` = '.mysql_real_escape_string($id).' AND ( `loop_id` IS NULL OR `loop_id` = \'\' ) LIMIT 0,1';
}
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
if($num_rows != 0){
$row = mysql_fetch_assoc($result);
mysql_free_result($result);
$text = stripslashes($row['text']);
if($mode=='long' || $mode=='short'){
$text = nl2br($text);
if(xhtml!=true){
$text = str_replace('<br />', '<br>', $text);
}
}
if(xhtml==true){
$xhtml = ' /';
}else{
$xhtml = '';
}
if($this->login()==true){
if($mode=='long' || $mode=='editor'){
echo '<div class="sce_text"><div class="sce_edit_link"><a href="'.root_url.'/'.sce_folder.'/text.php?mode='.$mode.'&id='.$row['id'].'" class="sce_edit_link_a">'.lang_edit_content.'</a></div><div class="sce_content">'.$options['before'].$text.$options['after'].'</div></div>';
}else{
echo $options['before'].'<a href="'.root_url.'/'.sce_folder.'/text.php?mode='.$mode.'&id='.$row['id'].'" class="sce_edit_link_short"><img src="'.root_url.'/'.sce_folder.'/images/page_edit.png" width="16" height="16" border="0"'.$xhtml.'></a> '.$text.$options['after'];
}
}else{
$text = trim($text);
if(!empty($text)){
echo $options['before'].$text.$options['after'];
}
}
}elseif($this->login()==true){
if($this->isLoop()){
$sql = 'INSERT INTO `sce_text` (`id`, `sce_id`, `text`, `loop_id`, `loop_row`, `created`, `modified`) VALUES (NULL, '.mysql_real_escape_string($id).', \'\', '.mysql_real_escape_string($loopID).', '.mysql_real_escape_string($loopI).', NOW(), NOW())';
}else{
$sql = 'INSERT INTO `sce_text` (`id`, `sce_id`, `text`, `created`, `modified`) VALUES (NULL, '.mysql_real_escape_string($id).', \'\', NOW(), NOW())';
}
mysql_query($sql) or die(mysql_errno().': '.mysql_error());
}
}
function image($id, $options=NULL){
global $loopID, $loops, $loopI;
if($this->isLoop()){
$sql = 'SELECT * FROM `sce_images` WHERE `sce_id` = '.mysql_real_escape_string($id).' AND `loop_id` = '.mysql_real_escape_string($loopID).' AND `loop_row` = '.mysql_real_escape_string($loopI).' LIMIT 0,1';
}else{
$sql = 'SELECT * FROM `sce_images` WHERE `sce_id` = '.mysql_real_escape_string($id).' AND ( `loop_id` IS NULL OR `loop_id` = \'\' ) LIMIT 0,1';
}
if(xhtml==true){
$xhtml = ' /';
}else{
$xhtml = '';
}
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
if($num_rows != 0){
$row = mysql_fetch_assoc($result);
mysql_free_result($result);
if($row['path']){
if($row['link']){
$aBefore = '<a href="'.stripslashes($row['link']).'" target="'.$options['target'].'" class="'.$options['link_class'].'" title="'.stripslashes($row['alt']).'">';
$aAfter = '</a>';
}else{
$aBefore = '';
$aAfter = '';
}
if($row['lightbox']==1){
if(!$options['lightbox']){
$options['lightbox'] = 'lightbox';
}
$aBefore = '<a href="'.root_url.'/'.sce_folder.stripslashes($row['path']).'" rel="lightbox" class="'.$options['link_class'].'" title="'.stripslashes($row['alt']).'">';
$aAfter = '</a>';
}
if($options['phpThumb']){
$phpThumb = '&'.$options['phpThumb'];
}else{
$phpThumb = '';
}
$imgTag = $aBefore.'<img src="'.root_url.'/'.sce_folder.'/libraries/phpThumb.php?src=..'.stripslashes($row['path']).$phpThumb.'" alt="'.stripslashes($row['alt']).'" title="'.stripslashes($row['alt']).'" class="'.$options['img_class'].'"'.$xhtml.'>'.$aAfter;
}else{
$imgTag = '';
}
if($this->login()==true){
echo '<div class="sce_image"><div class="sce_link_box"><a href="'.root_url.'/'.sce_folder.'/upload.php?mode=image&id='.$row['id'].'" class="sce_image_link">'.lang_edit_image.'</a></div><div class="sce_content">'.$imgTag.'</div></div>';
}else{
echo($imgTag);
}
}elseif($this->login()==true){
if($this->isLoop()){
$sql = 'INSERT INTO `sce_images` (`id`, `sce_id`, `path`, `alt`, `link`, `lightbox`, `loop_id`, `loop_row`) VALUES (\'\', '.mysql_real_escape_string($id).', \'\', \'\', NULL, NULL, '.mysql_real_escape_string($loopID).', '.mysql_real_escape_string($loopI).')';
}else{
$sql = 'INSERT INTO `sce_images` (`id`, `sce_id`, `path`, `alt`, `link`, `lightbox`, `loop_id`, `loop_row`) VALUES (\'\', '.mysql_real_escape_string($id).', \'\', \'\', NULL, NULL, NULL, NULL)';
}
mysql_query($sql) or die(mysql_errno().': '.mysql_error());
}
}
function file($id, $options=NULL){
global $loopID, $loops, $loopI;
if($this->isLoop()){
$sql = 'SELECT * FROM `sce_files` WHERE `sce_id` = '.mysql_real_escape_string($id).' AND `loop_id` = '.mysql_real_escape_string($loopID).' AND `loop_row` = '.mysql_real_escape_string($loopI).' LIMIT 0,1';
}else{
$sql = 'SELECT * FROM `sce_files` WHERE `sce_id` = '.mysql_real_escape_string($id).' AND ( `loop_id` IS NULL OR `loop_id` = \'\' ) LIMIT 0,1';
}
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
if($num_rows != 0){
$row = mysql_fetch_assoc($result);
mysql_free_result($result);
if($row['path']){
if($options['target']){
$target = ' target="'.$options['target'].'"';
}else{
$target = '';
}
if($options['class']){
$class = ' class="'.$options['class'].'"';
}else{
$class = '';
}
if($options['id']){
$aid = ' id="'.$options['id'].'"';
}else{
$aid = '';
}
$fileLink = '<a href="'.root_url.'/'.sce_folder.$row['path'].'"'.$target.$class.$aid.' title="'.$row['text'].'">'.$row['text'].'</a>';
$editText = '';
}else{
$fileLink = '';
$editText = lang_upload_file;
}
if($this->login()==true){
echo '<div class="sce_file"><a href="'.root_url.'/'.sce_folder.'/upload.php?mode=file&id='.$row['id'].'" class="sce_file_link">'.$editText.'</a>'.$fileLink.'</div>';
}else{
echo($fileLink);
}
}elseif($this->login()==true){
if($this->isLoop()){
$sql = 'INSERT INTO `sce_files` (`id`, `sce_id`, `path`, `text`, `loop_id`, `loop_row`) VALUES (\'\', '.mysql_real_escape_string($id).', \'\', \'\', '.mysql_real_escape_string($loopID).', '.mysql_real_escape_string($loopI).')';
}else{
$sql = 'INSERT INTO `sce_files` (`id`, `sce_id`, `path`, `text`, `loop_id`, `loop_row`) VALUES (\'\', '.mysql_real_escape_string($id).', \'\', \'\', NULL, NULL)';
}
mysql_query($sql) or die(mysql_errno().': '.mysql_error());
}
}
function newsLoop($options){
if(empty($options['show']) || !is_numeric($options['show'])){
$options['show'] = 3;
}
if( strtolower($options['order']) != 'asc' || strtolower($options['order']) != 'desc' ){
$options['order'] = 'ASC';
}
if($options['headlineID']){
$headlineSQL = ' OR `sce_id`='.$options['headlineID'];
$options['show'] = $options['show']*2;
}else{
$headlineSQL = '';
}
$sql = 'SELECT * FROM `sce_text` WHERE `loop_id`='.$options['loopID'].' AND (`sce_id`='.$options['textID'].$headlineSQL.') ORDER BY `loop_row` '.$options['order'].' LIMIT 0,'.$options['show'];
$result = mysql_query($sql);
while( $row=mysql_fetch_assoc($result) ){
switch ($row['sce_id']){
case $options['textID']:
$row['text'] = preg_replace("/^[^a-z0-9]?(.*?)[^a-z0-9]?$/i", "$1", $row['text']);
echo($options['textBefore'].substr($row['text'], 0, $options['textTrim']).'...'.$options['readMoreLink'].$options['textAfter']);
break;
case $options['headlineID']:
$row['text'] = preg_replace("/^[^a-z0-9]?(.*?)[^a-z0-9]?$/i", "$1", $row['text']);
echo($options['headlineBefore'].substr($row['text'], 0, $options['headlineTrim']).$options['headlineAfter']);
break;
}
}
}
function getExtension($str) {
$i = strrpos($str,'.');
if (!$i) { return ''; }
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
return $ext;
}
function countTableEntries($table,$countEmpty=false){
if($countEmpty==false){
$sql = 'SELECT * FROM `'.mysql_real_escape_string($table).'`';
}else{
$sql = 'SELECT * FROM `'.mysql_real_escape_string($table).'` WHERE `'.mysql_real_escape_string($countEmpty).'` = \'\' OR `'.mysql_real_escape_string($countEmpty).'` IS NULL';
}
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
return($num_rows);
}
function dbStatus(){
$AllEntries = $this->countTableEntries('sce_text') + $this->countTableEntries('sce_images') + $this->countTableEntries('sce_files');
$EmptyEntries = $this->countTableEntries('sce_text', 'text') + $this->countTableEntries('sce_images', 'path') + $this->countTableEntries('sce_files', 'path');
$percent = @round( ($EmptyEntries / $AllEntries) * 100 );
return($percent);
}
function dbOptimize(){
$sql = 'DELETE FROM `sce_text` WHERE `text` = \'\' OR `text` IS NULL';
$sql2 = 'OPTIMIZE TABLE `sce_text`';
mysql_query($sql);
mysql_query($sql2);
$sql = 'DELETE FROM `sce_files` WHERE `path` = \'\' OR `text` IS NULL';
$sql2 = 'OPTIMIZE TABLE `sce_files`';
mysql_query($sql);
mysql_query($sql2);
$sql = 'DELETE FROM `sce_images` WHERE `path` = \'\' OR `text` IS NULL';
$sql2 = 'OPTIMIZE TABLE `sce_images`';
mysql_query($sql);
mysql_query($sql2);
}
function actURL(){
$url = (isset($_SERVER['HTTPS'])?'https':'http').'://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']);
$url = str_ireplace('/'.sce_folder.'/setup', '', $url);
return($url);
}
function actPath(){
$path = dirname(__FILE__);
$path = str_ireplace('/libraries', '', $path);
return($path);
}
function checkPermissions(){
$config = '../config.php';
$uploads = '../uploads/';
$uploadsC = '../uploads/cache/';
if(version_pare(PHP_VERSION, '5.1.0') >= 0){
$output = '<span class="green">» PHP-Version: '.phpversion().'</span><br>';
}else{
$output = '<span class="red">» PHP-Version: '.phpversion().'</span><br>';
}
if(is_writable($config)){
$output .= '<span class="green">» '.lang_setup_permissions_config_good.'</span><br>';
}else{
$output .= '<span class="red">» '.lang_setup_permissions_config_bad.'</span><br>';
}
if(is_writable($uploads)){
$output .= '<span class="green">» '.lang_setup_permissions_uploads_good.'</span><br>';
}else{
$output .= '<span class="red">» '.lang_setup_permissions_uploads_bad.'</span><br>';
}
if(is_writable($uploadsC)){
$output .= '<span class="green">» '.lang_setup_permissions_uploads_cache_good.'</span><br>';
}else{
$output .= '<span class="red">» '.lang_setup_permissions_uploads_cache_bad.'</span><br>';
}
return($output);
}
function createConfig($data){
$confTemplate = '../config.example.php';
$loadConfigTemplate = file_get_contents($confTemplate) or die('Can\'t load: '.$confTemplate);
$username = $data['username'];
$password = $data['password'];
$url = $data['url'];
$path = $data['path'];
$lang = $data['lang'];
$sql_server = $data['sql_server'];
$sql_username = $data['sql_username'];
$sql_password = $data['sql_password'];
$sql_db = $data['sql_db'];
if($data['html']=='html'){
$html = 'false';
}else{
$html = 'true';
}
if(
!empty($username) &&
!empty($password) &&
!empty($url) &&
!empty($path) &&
!empty($sql_server) &&
!empty($sql_username) &&
!empty($sql_db) &&
!empty($html)
){
$loadConfigTemplate = str_replace('MYSQL_HOST', $sql_server, $loadConfigTemplate);
$loadConfigTemplate = str_replace('MYSQL_DATABASE', $sql_db, $loadConfigTemplate);
$loadConfigTemplate = str_replace('MYSQL_USER', $sql_username, $loadConfigTemplate);
$loadConfigTemplate = str_replace('MYSQL_PW', $sql_password, $loadConfigTemplate);
$loadConfigTemplate = str_replace('FRONTEND_URL', $url, $loadConfigTemplate);
$loadConfigTemplate = str_replace('XHTML_SETTING', $html, $loadConfigTemplate);
$loadConfigTemplate = str_replace('SIMPLECE_PATH', $path, $loadConfigTemplate);
$loadConfigTemplate = str_replace('SIMPLECE_FOLDER', 'simpleCE', $loadConfigTemplate);
$loadConfigTemplate = str_replace('SIMPLECE_LANG', $lang, $loadConfigTemplate);
$loadConfigTemplate = str_replace('SIMPLECE_USER', $username, $loadConfigTemplate);
$loadConfigTemplate = str_replace('SIMPLECE_PW', md5($password), $loadConfigTemplate);
$fp = fopen('../config.php', 'w+') or die('Can\'t open / create config.php!');
fwrite($fp, $loadConfigTemplate);
fclose ($fp);
return(60);
}else{
return('Please fill out all fields in the form!');
}
}
function installDB(){
$sce_files = '
CREATE TABLE sce_files (
id int(11) NOT NULL auto_increment,
sce_id int(11) NOT NULL,
path varchar(500) NOT NULL,
`text` varchar(200) NOT NULL,
loop_id int(11) default NULL,
loop_row int(11) default NULL,
PRIMARY KEY (id)
) DEFAULT CHARSET=utf8;';
$sce_images = '
CREATE TABLE sce_images (
id int(11) NOT NULL auto_increment,
sce_id int(11) NOT NULL,
path varchar(400) NOT NULL,
alt varchar(200) NOT NULL,
link varchar(400) default NULL,
lightbox int(11) default NULL,
loop_id int(11) default NULL,
loop_row int(11) default NULL,
PRIMARY KEY (id)
) DEFAULT CHARSET=utf8;';
$sce_loops = '
CREATE TABLE sce_loops (
id int(11) NOT NULL auto_increment,
loop_id int(11) NOT NULL,
`rows` int(11) NOT NULL,
PRIMARY KEY (id)
) DEFAULT CHARSET=utf8;';
$sce_text = '
CREATE TABLE sce_text (
id int(11) NOT NULL auto_increment,
sce_id int(11) NOT NULL,
`text` text NOT NULL,
loop_id int(11) default NULL,
loop_row int(11) default NULL,
created datetime NOT NULL,
modified datetime NOT NULL,
PRIMARY KEY (id)
) DEFAULT CHARSET=utf8;';
if(
mysql_query($sce_files) &&
mysql_query($sce_images) &&
mysql_query($sce_loops) &&
mysql_query($sce_text)
){
return(100);
}else{
return(mysql_errno().': '.mysql_error());
}
}
}
$simpleCE = new simpleCE();
?>
Share
Improve this question
edited Sep 22, 2013 at 9:24
itachi
6,3933 gold badges33 silver badges41 bronze badges
asked Sep 22, 2013 at 9:17
user2756554user2756554
4
- 1 do you have jQuery ui included in the page – Arun P Johny Commented Sep 22, 2013 at 9:22
- ^^^ that, and make sure it's included after jQuery. – Reinstate Monica Cellio Commented Sep 22, 2013 at 9:25
- the PHP code is pletely irrelevant to your problem. – Alnitak Commented Sep 22, 2013 at 9:27
- I have deleted the jQuery ui and everything is still working as it is, but didn't solve the problem tho – user2756554 Commented Sep 22, 2013 at 9:39
3 Answers
Reset to default 2You have two versions of jQuery included in the page 1.10.1 (<script src="http://codysilverkin./editor/js/jquery.js"></script>
) and 1.8.3(<script type="text/javascript" src="assets/libraries/jquery.js"></script>
), remove the second include and it will work fine.
Here the jQuery UI library is added to jQuery 1.8.3(first), then when jQuery 1.10.1 is included, so when you refer to jQuery in your page it is refering to version 1.10.1 where UI is not available
You are loading two different jquery libs on the same page, 1.8.3 with ui, 1.10.1 without ui. My guess would be the latter loaded 1.10.1 overrides 1.8.3 thus ui support is gone with it. Please fix this first and see how it goes.
Here is a noob fail error that i just made... hope it helps someone:
I had 'jqueryui' included in my page but kept getting ".dialog is not a function" errors...
The problem was that i actually had jquery.ui.custom.min.js included on the page.
Note the "custom"... this means the whole library is not there, and guess what - the 'dialog' api was not included in the custom version i was using... duh.
Solution - Go to the jqueryui site and get another custom versiob that includes 'dialog'.