function add_dir_parsed($dir, $group_id, $parent_id = -1) { // Add all pictures under the Directory $dir to categories and series depending on the relativ path to $dir global $db, $config_vars, $filetypes; if ($parent_id == -1) { $parent_id = $config_vars['root_categorie']; } $dir_handle = opendir($dir); while ($file = readdir($dir_handle)) { if ($file != "." && $file != "..") { $dir_and_file = $dir . '/' . $file; if (isset($filetypes[getext($file)])) { // $file is content // generate a new album_content obj add_content($file, $dir_and_file, getfile($file), $parent_id, 0, $group_id); } elseif (is_dir($dir_and_file)) { //file is a sub dir $cat = new categorie(); $cat->set_name($file); $cat->set_parent_id($parent_id); $cat->fill_up(); $cat->set_catgroup_id($group_id); if (!isset($cat->id)) { $cat->commit(); } add_dir_parsed($dir . '/' . $file, $group_id, $cat->get_id()); } } } closedir($dir_handle); }
$message['error'] .= '<li>Quote field is required.</li>'; } if (!$proper) { $message['error'] .= '<li>CSRF Token not correct.</li>'; } config('views.root', 'system/admin/views'); render('add-content', array('title' => 'Add quote - ' . blog_title(), 'description' => blog_description(), 'canonical' => site_url(), 'error' => '<ul>' . $message['error'] . '</ul>', 'postTitle' => $title, 'postQuote' => $quote, 'postTag' => $tag, 'postUrl' => $url, 'postContent' => $content, 'type' => 'is_quote', 'bodyclass' => 'addquote', 'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Add Quote')); } } if (!empty($is_link)) { if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($link)) { if (!empty($url)) { add_content($title, $tag, $url, $content, $user, $description, $link, $draft, $category, 'link'); } else { $url = $title; add_content($title, $tag, $url, $content, $user, $description, $link, $draft, $category, 'link'); } } else { $message['error'] = ''; if (empty($title)) { $message['error'] .= '<li>Title field is required.</li>'; } if (empty($tag)) { $message['error'] .= '<li>Tag field is required.</li>'; } if (empty($content)) { $message['error'] .= '<li>Content field is required.</li>'; } if (empty($link)) { $message['error'] .= '<li>Link field is required.</li>'; }
$smarty->assign('add_to_contentgroups', $add_to_contentgroups); } } if (check_cat_action_allowed($category->get_catgroup_id(), $userdata['user_id'], 'comment_edit')) { $smarty->assign('allow_comment_edit', true); } // check if user is allowed to add content if (check_cat_action_allowed($category->get_catgroup_id(), $userdata['user_id'], 'content_add')) { $smarty->assign('allow_content_add', true); // get catgroups where add_to_group is allowed $add_to_contentgroups = get_contentgroups_data_where_perm('id,name', 'add_to_group'); $smarty->assign('add_to_contentgroups', $add_to_contentgroups); if (isset($HTTP_POST_VARS['newcontent'])) { $objtyp = $filetypes[getext($HTTP_POST_FILES['new_content_file']['name'])]; if (isset($objtyp)) { add_content($HTTP_POST_FILES['new_content_file']['name'], $HTTP_POST_FILES['new_content_file']['tmp_name'], $HTTP_POST_VARS['new_content_name'], $HTTP_GET_VARS['cat_id'], $HTTP_POST_VARS['new_content_place_in_cat'], $HTTP_POST_VARS['new_content_group']); } elseif (eregi("zip\$", $HTTP_POST_FILES['new_content_file']['name'])) { // its a zip file $zip = new PclZip($HTTP_POST_FILES['new_content_file']['tmp_name']); $folder = $config_vars['default_upload_dir'] . "/zip_" . $userdata['username']; makedir($folder); $zip->extract(PCLZIP_OPT_PATH, $folder); add_dir_parsed($folder, $HTTP_POST_VARS['new_content_group'], $HTTP_GET_VARS['cat_id']); // remove directory; unlink($folder . "/index.html"); rmdir($folder); } } } if (intval($HTTP_SESSION_VARS['first_content']) == '') { $HTTP_SESSION_VARS['first_content'] = 0;
session_start(); $add_to_contentgroups = get_contentgroups_data_where_perm('id,name', 'add_to_group'); if (!is_array($add_to_contentgroups)) { die('You dont have perms to add content to any contentgroup'); } $smarty->assign('add_to_contentgroups', $add_to_contentgroups); $cats = get_cats_data_where_perm('id,name', 'content_add'); $add_to_cats = get_cats_string($cats); if (!is_array($add_to_cats)) { die('You dont have perms to add content to any categorie'); } $smarty->assign('add_to_cats', $add_to_cats); if (isset($content_to_add)) { $place = 0; foreach ($content_to_add as $value) { add_content(basename($value), $value, "", $new_content_cat, $place, $new_content_group); $place++; } } $dir = $config_vars['default_upload_dir']; if ($HTTP_POST_VARS['moveup'] == "up") { $temp = $HTTP_SESSION_VARS['files'][$HTTP_POST_VARS['id'] - 1]; $HTTP_SESSION_VARS['files'][$HTTP_POST_VARS['id'] - 1] = $HTTP_SESSION_VARS['files'][$HTTP_POST_VARS['id']]; $HTTP_SESSION_VARS['files'][$HTTP_POST_VARS['id']] = $temp; } else { if ($HTTP_POST_VARS['movedown'] == "down") { $temp = $HTTP_SESSION_VARS['files'][$id + 1]; $HTTP_SESSION_VARS['files'][$id + 1] = $HTTP_SESSION_VARS['files'][$id]; $HTTP_SESSION_VARS['files'][$id] = $temp; } elseif (isset($dir)) { unset($HTTP_SESSION_VARS['files']);
function set_content($type, $data, $vars = array()) { $content =& content(); $content = ''; add_content($type, $data, $vars); }