Esempio n. 1
0
}
$the_active_site_template = CI::model('core')->optionsGetByKey('curent_template');
$the_active_site_template_dir = TEMPLATEFILES . $the_active_site_template . '/';
$the_template_url = site_url('userfiles/' . TEMPLATEFILES_DIRNAME . '/' . $the_active_site_template);
$the_template_url = $the_template_url . '/';
if (defined('TEMPLATE_URL') == false) {
    define("TEMPLATE_URL", $the_template_url);
}
if (defined('USERFILES_URL') == false) {
    define("USERFILES_URL", site_url('userfiles/'));
}
if (defined('USERFILES_DIR') == false) {
    define("USERFILES_DIR", USERFILES);
}
if (defined('MODULES_DIR') == false) {
    define("MODULES_DIR", USERFILES . 'modules/');
}
if (defined('LAYOUTS_DIR') == false) {
    $layouts_dir = TEMPLATES_DIR . 'layouts/';
    define("LAYOUTS_DIR", $layouts_dir);
} else {
    $layouts_dir = LAYOUTS_DIR;
}
if (defined('LAYOUTS_URL') == false) {
    $layouts_url = reduce_double_slashes(dirToURL($layouts_dir) . '/');
    define("LAYOUTS_URL", $layouts_url);
} else {
    $layouts_url = LAYOUTS_URL;
}
$this->template['layouts_dir'] = $layouts_dir;
$this->template['layouts_url'] = $layouts_url;
Esempio n. 2
0
// post-submit callback 
function save_post_showResponse(responseText, statusText, xhr, $form)  { 
//document.getElementById('edit_frame').contentWindow.location.reload();


   // alert('status: ' + statusText + '\n\nresponseText: \n' + responseText +    '\n\nThe output div should have already been updated with the responseText.'); 
} 
</script>
<script type="text/javascript">
 
 


</script>

<? $url_to_module = dirToURL(dirname(__FILE__));
$url_to_module_static = $url_to_module. '/static/icons/' ; ?>

<form action="" method="post" id="save_post_form">
  <input name="id" id="post_id" type="hidden" value="<? print $form_values['id'] ?>" />
  <input name="content_type" type="hidden" value="post" />
  <mw module="admin/content/title_and_body" id="<? print $form_values['id'] ?>" />
  <br />
  <br />
  <br />
  <script>
  $(document).ready(function() {
    //$("#tabs").tabs();
  });
  </script>
Esempio n. 3
0
                         $layout = $this->load->file($the_active_site_template_dir . 'layouts/' . 'default_layout.php', true);
                     } else {
                         header("HTTP/1.1 500 Internal Server Error");
                         show_error("Layout file {$content['content_layout_file']} is not readable or doesn't exist in the templates directory!");
                         exit;
                     }
                 }
             }
         }
     }
 }
 if ($content['content_layout_name'] != '') {
     $this->template['content'] = $content;
     $layout_dir = TEMPLATES_DIR . 'layouts/' . $content['content_layout_name'] . '/';
     $this->template['layout_dir'] = $layout_dir;
     $this->template['layout_url'] = reduce_double_slashes(dirToURL($layout_dir) . '/');
     $this->load->vars($this->template);
     $layout = TEMPLATES_DIR . 'layouts/' . $content['content_layout_name'] . '/index.php';
     $layout = $this->load->file($layout, true);
     //
 }
 //	p($page);
 //if ($content ['content_layout_file'] == '') {
 //}
 //} else {
 //	$this->load->vars ( $this->template );
 //	$layout = $this->load->file ( $the_active_site_template_dir . 'affiliate_site_1/default_layout.php', true );
 //}
 if (trim($content['content_filename']) != '') {
     if (is_readable($the_active_site_template_dir . $content['content_filename']) == true) {
         $this->load->vars($this->template);
Esempio n. 4
0
 function upload($to_table, $to_table_id = false, $queue_id = false, $collection = false)
 {
     $user_id = user_id();
     if (intval($user_id) == 0) {
         exit('Only logged users can upload!');
     }
     if ($to_table != false) {
         $to_table = $this->guessDbTable($to_table);
     }
     $target_path = MEDIAFILES;
     $uploaded = array();
     if (empty($_FILES)) {
         //return false;
     }
     if (!empty($_FILES)) {
         foreach ($_FILES as $k => $item) {
             $target_path = MEDIAFILES;
             $filename = basename($_FILES[$k]['name']);
             if (strval($filename) != '') {
                 $filename = strtolower($filename);
                 $path = $target_path . '/';
                 if (is_dir($path) == false) {
                     @mkdir($path);
                     //@chmod ( $path, '0777' );
                 }
                 $the_target_path = $target_path . '/original/';
                 $original_path = $the_target_path;
                 if (is_dir($the_target_path) == false) {
                     @mkdir($the_target_path);
                     //@chmod ( $the_target_path, '0777' );
                 }
                 $the_target_path = $the_target_path . $this->url_title($filename, $separator = 'dash', $no_slashes = false, $leave_dots = true);
                 if (is_file($the_target_path) == true) {
                     $filename = date("ymdHis") . basename($_FILES[$k]['name']);
                     $the_target_path = $original_path . $this->url_title($filename, $separator = 'dash', $no_slashes = false, $leave_dots = true);
                 }
                 if (stristr($the_target_path, '.exe') or stristr($the_target_path, '.php') or stristr($the_target_path, '.pl') or stristr($the_target_path, '.cgi')) {
                     exit('This file type is not permited due security measures!');
                 }
                 if (move_uploaded_file($_FILES[$k]['tmp_name'], $the_target_path)) {
                     if (is_file($the_target_path) == true) {
                         $upl = array();
                         if (is_readable($the_target_path) == true) {
                             $fn1 = $this->url_title($filename, $separator = 'dash', $no_slashes = false, $leave_dots = true);
                             //exit ();
                             $upl['filename'] = $fn1;
                             $extension = substr(strrchr($fn1, '.'), 1);
                             $extension_lower = strtolower($extension);
                             switch ($extension_lower) {
                                 case 'jpg':
                                 case 'jpeg':
                                 case 'gif':
                                 case 'png':
                                 case 'bmp':
                                     $target_path_pictures_folder = MEDIAFILES . 'pictures/original/';
                                     $target_path_pictures_folder = normalize_path($target_path_pictures_folder);
                                     $target_path_pictures_file = basename($the_target_path);
                                     $target_path_pictures_new = $target_path_pictures_folder . $target_path_pictures_file;
                                     //p($target_path_pictures_new);
                                     rename($the_target_path, $target_path_pictures_new);
                                     list($width, $height, $type, $attr) = getimagesize($target_path_pictures_new);
                                     $status = array();
                                     $status['done'] = 1;
                                     $status['width'] = $width;
                                     $status['height'] = $height;
                                     $status['url'] = dirToURL($target_path_pictures_new);
                                     $statuses[] = $status;
                                     //$status = json_encode ( $status );
                                     if ($to_table == false) {
                                         return $status;
                                     }
                                     $upl['status'] = $status;
                                     $upl['type'] = 'picture';
                                     break;
                                 case 'flv':
                                 case 'avi':
                                 case 'mov':
                                 case 'f4v':
                                 case 'afs':
                                     $target_path_pictures_folder = MEDIAFILES . 'videos/';
                                     $target_path_pictures_folder = normalize_path($target_path_pictures_folder);
                                     $target_path_pictures_file = basename($the_target_path);
                                     $target_path_pictures_new = $target_path_pictures_folder . $target_path_pictures_file;
                                     //p($target_path_pictures_new);
                                     rename($the_target_path, $target_path_pictures_new);
                                     $upl['type'] = 'video';
                                     break;
                                 default:
                                     $target_path_pictures_folder = MEDIAFILES . 'files/';
                                     $target_path_pictures_folder = normalize_path($target_path_pictures_folder);
                                     $target_path_pictures_file = basename($the_target_path);
                                     $target_path_pictures_new = $target_path_pictures_folder . $target_path_pictures_file;
                                     //p($target_path_pictures_new);
                                     rename($the_target_path, $target_path_pictures_new);
                                     $upl['type'] = 'file';
                                     break;
                             }
                             $uploaded[$k] = $upl;
                         }
                     }
                 }
             }
         }
     }
     if ($to_table == false) {
         return $status;
     }
     if (trim($_POST['embed_code']) != '') {
         $embed_item = array();
         $embed_item['embed_code'] = $_POST['embed_code'];
         if ($_POST['screenshot_url']) {
             $target_path_pictures_folder = MEDIAFILES . 'pictures/original/';
             $newfilename1 = date('YMDHis') . basename($_POST['screenshot_url']);
             $newfilename = $target_path_pictures_folder . $newfilename1;
             $this->url_getPageToFile($_POST['screenshot_url'], $newfilename);
             $embed_item['filename'] = $newfilename1;
         }
         if ($_POST['original_link']) {
             $embed_item['original_link'] = $_POST['original_link'];
         }
         if ($_POST['type']) {
             $embed_item['type'] = $_POST['type'];
         }
         if ($_POST['media_type']) {
             $embed_item['type'] = $_POST['media_type'];
         }
         if ($_POST['media_name']) {
             $embed_item['media_name'] = $_POST['media_name'];
         }
         if ($_POST['media_description']) {
             $embed_item['media_description'] = $_POST['media_description'];
         }
         $uploaded[] = $embed_item;
     }
     if (!empty($uploaded)) {
         global $cms_db_tables;
         $table = $cms_db_tables['table_media'];
         $media_table = $table;
         foreach ($uploaded as $item) {
             if (!empty($item)) {
                 $media_save = array();
                 foreach ($item as $item_k => $item_v) {
                     $media_save[$item_k] = $item_v;
                 }
                 $media_save['media_type'] = $item['type'];
                 $media_save['filename'] = $item['filename'];
                 $media_save['to_table'] = $to_table;
                 if ($collection != false) {
                     $media_save['collection'] = $collection;
                 }
                 if (intval($to_table_id) != 0) {
                     $media_save['to_table_id'] = $to_table_id;
                 } else {
                     if (strval($queue_id) != '') {
                         $media_save['queue_id'] = $queue_id;
                     }
                 }
                 //p ( $media_save );
                 $this->saveData($table, $media_save);
             }
         }
         //
         if (intval($to_table_id) != 0) {
             $this->mediaFixOrder($to_table, $to_table_id, 'picture');
         }
         if (trim($to_table) != '' and trim($to_table_id) != '') {
             $cache_group = "media/{$to_table}/{$to_table_id}";
             $this->cleanCacheGroup($cache_group);
         }
         $this->cleanCacheGroup('media/global');
         $this->cleanCacheGroup('global');
         return $uploaded;
     } else {
         return false;
     }
 }
Esempio n. 5
0
//p($thumb);
?>
    <a href="<? print  $orig; ?>"  title="<?php print addslashes($pic['media_name']); ?>"  alt="<?php print addslashes($pic['media_description']); ?>" > <img src="<? print  $thumb; ?>" /></a> 
    <?php $i++; endforeach; ?>
    <?php endif; ?>
    
    
    <?php else : ?>
    
    <?
	
	
	$skin_file = dirname(__FILE__).'/skins/'.$skin.'.php';
	$skin_file  = normalize_path($skin_file ,0);
	
	$skins_url =dirToURL(dirname(__FILE__).'/skins/').'/';
	?>
     <?  if(is_file($skin_file)): ?>
    
    <?  include($skin_file); ?>
     <?php endif; ?>
 <?php endif; ?>
 
 
 
 

<?php endif; ?>