if ($fileId) { $feedback[] = tra('Upload was successful') . ': ' . $name; @unlink($filepath); // seems to return false sometimes even if the file was deleted if (!file_exists($filepath)) { $feedback[] = sprintf(tra('File %s removed from Batch directory.'), $file); } else { $feedback[] = "!!! " . sprintf(tra('Impossible to remove file %s from Batch directory.'), $file); } } } } } $a_file = array(); $a_path = array(); buildFileList(); $smarty->assign('feedback', $feedback); if (isset($_REQUEST["galleryId"])) { $smarty->assign_by_ref('galleryId', $_REQUEST["galleryId"]); $smarty->assign('permAddGallery', 'n'); if ($tiki_p_admin_file_galleries == 'y' || $userlib->object_has_permission($user, $_REQUEST["galleryId"], 'image gallery', 'tiki_p_create_file_galleries')) { $smarty->assign('permAddGallery', 'y'); } } else { $smarty->assign('galleryId', ''); } $galleries = $filegallib->list_file_galleries(0, -1, 'name_asc', $user, '', $prefs['fgal_root_id']); $temp_max = count($galleries["data"]); for ($i = 0; $i < $temp_max; $i++) { if ($userlib->object_has_one_permission($galleries["data"][$i]["galleryId"], 'file gallery')) { $galleries["data"][$i]["individual"] = 'y';
function getMinifyGroupsConfig() { $minifyConfig = array(); $key = $_GET['g']; // // Check for specific file request // if (strpos($key, MIN_FILE_PREFIX) === 0) { // file path relative to either templates or the theme (check theme first) $path = substr($key, strlen(MIN_FILE_PREFIX)); $config = array('include' => 'all', 'files' => array(THEME_DIR . $path, SITE_APP_DIR . $path, APP_DIR . $path)); return array($key => buildFileList($config)); } // // Page request // $pageOnly = isset($_GET['pageOnly']) && $_GET['pageOnly']; // if this is a copied module also pull in files from that module $configModule = isset($_GET['config']) ? $_GET['config'] : ''; list($ext, $module, $page, $pagetype, $platform, $pathHash) = explode('-', $key); $cache = new DiskCache(CACHE_DIR . '/minify', Kurogo::getOptionalSiteVar('MINIFY_CACHE_TIMEOUT', 30), true); $cacheName = "group_{$key}"; if ($configModule) { $cacheName .= "-{$configModule}"; } if ($pageOnly) { $cacheName .= "-pageOnly"; } if ($cache->isFresh($cacheName)) { $minifyConfig = $cache->read($cacheName); } else { $dirs = array(APP_DIR, SITE_APP_DIR, THEME_DIR); if ($pageOnly || ($pagetype == 'tablet' || $platform == 'computer') && in_array($module, array('info', 'admin'))) { // Info module does not inherit from common files $subDirs = array('/modules/' . $module); } else { $subDirs = array('/common', '/modules/' . $module); } if ($configModule) { $subDirs[] = '/modules/' . $configModule; } $checkFiles = array('css' => getCSSFileConfigForDirs($page, $pagetype, $platform, $dirs, $subDirs, $pageOnly), 'js' => getJSFileConfigForDirs($page, $pagetype, $platform, $dirs, $subDirs, $pageOnly)); //error_log(print_r($checkFiles, true)); $minifyConfig[$key] = buildFileList($checkFiles[$ext]); //error_log(__FUNCTION__."($pagetype-$platform) scanned filesystem for $key"); $cache->write($minifyConfig, $cacheName); } // Add minify source object for the theme config.ini if ($ext == 'css') { $themeVarsFile = realpath_exists(THEME_DIR . '/config.ini'); if ($themeVarsFile) { $minifyConfig[$key][] = new Minify_Source(array('id' => 'themeConfigModTimeChecker', 'getContentFunc' => 'minifyThemeConfigModTimeCheckerContent', 'minifier' => '', 'contentType' => Minify::TYPE_CSS, 'lastModified' => filemtime($themeVarsFile))); } } //error_log(__FUNCTION__."($pagetype-$platform) returning: ".print_r($minifyConfig, true)); return $minifyConfig; }
function getMinifyGroupsConfig() { $minifyConfig = array(); $key = $_GET['g']; // // Check for specific file request // if (strpos($key, MIN_FILE_PREFIX) === 0) { // file path relative to either templates or the theme (check theme first) $path = substr($key, strlen(MIN_FILE_PREFIX)); $config = array( 'include' => 'all', 'files' => array( THEME_DIR.$path, SITE_APP_DIR.$path, APP_DIR.$path, ), ); return array($key => buildFileList($config)); } // // Page request // $pageOnly = isset($_GET['pageOnly']) && $_GET['pageOnly']; // if this is a copied module also pull in files from that module $configModule = isset($_GET['config']) ? $_GET['config'] : ''; list($ext, $module, $page, $pagetype, $platform, $pathHash) = explode('-', $key); $cache = new DiskCache(CACHE_DIR.'/minify', 30, true); $cacheName = "group_$key"; if ($cache->isFresh($cacheName)) { $minifyConfig = $cache->read($cacheName); } else { // CSS includes all in order. JS prefers theme $cssDirs = array( APP_DIR, SITE_APP_DIR, THEME_DIR, ); $jsDirs = array( THEME_DIR, SITE_APP_DIR, APP_DIR, ); if ($pageOnly || ($platform=='computer' && in_array($module, array('info', 'admin')))) { // Info module does not inherit from common files $subDirs = array( '/modules/'.$module ); } else { $subDirs = array( '/common', '/modules/'.$module, ); } if ($configModule) { $subDirs[] = '/modules/' . $configModule; } $checkFiles = array( 'css' => getCSSFileConfigForDirs( $page, $pagetype, $platform, $cssDirs, $subDirs, $pageOnly), 'js' => getJSFileConfigForDirs ( $page, $pagetype, $platform, $jsDirs, $subDirs, $pageOnly), ); //error_log(print_r($checkFiles, true)); $minifyConfig[$key] = buildFileList($checkFiles[$ext]); //error_log(__FUNCTION__."($pagetype-$platform) scanned filesystem for $key"); $cache->write($minifyConfig, $cacheName); } //error_log(__FUNCTION__."($pagetype-$platform) returning: ".print_r($minifyConfig, true)); return $minifyConfig; }
} catch (Exception $e) { echo $e->getMessage(); } if ($result) { if (isset($_SESSION['upload'])) { $_SESSION['upload'] = array_merge($_SESSION['upload'], $loader->getNameList()); } else { $_SESSION['upload'] = $loader->getNameList(); } header("Location: review.php"); die; } } //Gets all images user can delete. //Replace with database $filenames = buildFileList($dir, ['jpg', 'png', 'gif', 'jpeg']); if (isset($_POST['delete'])) { $id = $_POST['id']; unlink($dir . $filenames[$id]); unlink($thumbdir . "thumb_" . $filenames[$id]); unset($filenames[$id]); natcasesort($filenames); } //Gets files in image dir //Replace with database function buildFileList($dir, $extensions) { if (!is_dir($dir) || !is_readable($dir)) { return false; } else { if (is_array($extensions)) {
function getMinifyGroupsConfig() { $minifyConfig = array(); $key = $_GET['g']; // javascript and css search directory order $dirs = array(APP_DIR, SHARED_APP_DIR, SITE_APP_DIR, SHARED_THEME_DIR, THEME_DIR); // // Check for specific file request // if (strpos($key, MIN_FILE_PREFIX) === 0) { // file path relative to either templates or the theme (check theme first) $path = substr($key, strlen(MIN_FILE_PREFIX)); $files = array(); foreach ($dirs as $dir) { if ($dir) { $files[] = $dir . $path; } } $config = array('include' => 'all', 'files' => $files); return array($key => buildFileList($config)); } // // Page request // $pageOnly = isset($_GET['pageOnly']) && $_GET['pageOnly']; $noCommon = $pageOnly || isset($_GET['noCommon']) && $_GET['noCommon']; // if this is a copied module also pull in files from that module $configModule = isset($_GET['config']) ? $_GET['config'] : ''; list($ext, $module, $page, $pagetype, $platform, $browser, $pathHash) = explode('-', $key); $cache = new DiskCache(CACHE_DIR . '/minify', Kurogo::getOptionalSiteVar('MINIFY_CACHE_TIMEOUT', 30), true); $cacheName = "group_{$key}"; $Kurogo = Kurogo::sharedInstance(); $Kurogo->setCurrentModuleID($module); if ($configModule) { $Kurogo->setCurrentConfigModule($configModule); $cacheName .= "-{$configModule}"; } if ($pageOnly) { $cacheName .= "-pageOnly"; } if ($cache->isFresh($cacheName)) { $minifyConfig = $cache->read($cacheName); } else { if ($noCommon) { // Info module does not inherit from common files $subDirs = array('/modules/' . $module); } else { $subDirs = array('/common', '/modules/' . $module); } if ($configModule && $configModule !== $module) { $subDirs[] = '/modules/' . $configModule; } $checkFiles = array('css' => getFileConfigForDirs('css', 'css', $page, $pagetype, $platform, $browser, $dirs, $subDirs, $pageOnly), 'js' => getFileConfigForDirs('js', 'javascript', $page, $pagetype, $platform, $browser, $dirs, $subDirs, $pageOnly)); //error_log(print_r($checkFiles, true)); $minifyConfig[$key] = buildFileList($checkFiles[$ext]); //error_log(__FUNCTION__."($pagetype-$platform-$browser) scanned filesystem for $key"); $cache->write($minifyConfig, $cacheName); } // Add minify source object for the theme config if ($ext == 'css') { $themeConfig = Kurogo::getThemeConfig(); if ($themeConfig) { $minifyConfig[$key][] = new Minify_Source(array('id' => 'themeConfigModTimeChecker', 'getContentFunc' => 'minifyThemeConfigModTimeCheckerContent', 'minifier' => '', 'contentType' => Minify::TYPE_CSS, 'lastModified' => $themeConfig->getLastModified())); } } //error_log(__FUNCTION__."($pagetype-$platform-$browser) returning: ".print_r($minifyConfig, true)); return $minifyConfig; }
<?php $pages = buildFileList($list_dir, array($file_type)); //print_r($pages); foreach ($pages as $page) { $page_name = $page; $search = array($prefix, $extension, '-'); $replace = array('', '', ' '); $page_name = str_replace($search, $replace, $page_name); $page_name = ucwords($page_name); echo "<li><a href=\"{$page}\">" . $page_name . "</a></li>"; }
function writeRss($title, $link, $description, $copyright, $dir, $ext, $language = 'en-us') { // check dir for existence and readability $path = '../' . $dir . '/'; $exists = file_exists($path); $link = urlencode($link); $success = ''; $rssFile = '../feed.rss'; if (!$exists) { die("Directory '{$path}' does not exist!"); } else { $rss = new XMLWriter(); $rss->openMemory(); $rss->startDocument('1.0', 'UTF-8'); $rss->setIndent(4); // declare it as an rss document $rss->startElement('rss'); $rss->writeAttribute('version', '2.0'); $rss->writeAttribute('xmlns:atom', 'http://www.w3.org/2005/Atom'); $rss->startElement('channel'); $rss->writeElement('title', $title); $rss->writeElement('description', $description); $rss->writeElement('language', $language); $rss->writeElement('link', urldecode($link)); $rss->writeElement('pubDate', date("D, d M Y H:i:s e")); $rss->writeElement('copyright', $copyright); // collect post files $results = buildFileList($path, $ext); if (!$results) { die('Files not found.'); } else { $results = str_replace(".{$ext}", '', $results); // sort array function included with buildlist usort($results, 'blogsort'); $sliced_array = array_slice($results, 0, 10); for ($i = 0; $i <= count($sliced_array) - 1; $i++) { $link = $path . $results[$i] . '.txt'; //echo $link; exit; $error = ''; if (!is_readable($link)) { $error .= "{$link}: file is unreadable or does not exist.\n"; } else { $lines = file($link, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES | FILE_TEXT); $itemlink = str_replace(array('../', '.txt'), '', $link); $itemlink = str_replace('/', '/single.php?post=', $ilink); $itemlink = urlencode('http://bekahsealey.com/' . $ilink); $r = 0; $itempubDate = strtotime($lines[$r]); $itempubDate = date("D, d M Y H:i:s e", $itempubDate); $r++; $itemtitle = $lines[$r]; $r++; if ($lines[$r][0] == '[') { $r++; } if ($lines[$r][0] == '{') { $r++; } $itemdescription = $lines[$r]; $rss->startElement("item"); $rss->writeElement('title', $itemtitle); $rss->writeElement('link', 'http://bekahsealey.com/blog/'); $rss->writeElement('description', $itemdescription); $rss->writeElement('guid', $itemlink); $rss->writeElement('pubDate', $itempubDate); // End Item $rss->endElement(); } } } // End channel $rss->endElement(); // End rss $rss->endElement(); $rss->endDocument(); $success = file_put_contents($rssFile, $rss->outputMemory()); $rss->flush(); if ($success != false || $success != '') { echo "RSS written!"; } else { echo "There was a problem."; } if ($error != false || $error != '') { echo $error; } } }