function quickUpdate() { global $db, $prefix, $iConfig, $moduleName, $user, $cookie, $admin, $aid; if (is_user($user)) { $submitter = $cookie[0]; } elseif (is_admin($admin)) { $submitter = substr($aid, 0, 25); } $picturesPath = $iConfig['pictures_path']; $thumbsPath = $iConfig['thumbs_path']; $picturesRealPath = iPath($picturesPath); $thumbsRealPath = iPath($thumbsPath); $albumList = scanAlbums($picturesRealPath); foreach ($albumList as $albums) { $albumRelativePath = substr(str_replace($picturesRealPath, '', $albums), 0, -1); $albumName = basename($albums); $parentPath = substr($albumRelativePath, 0, strlen($albumRelativePath) - 1); $parentPath = substr($parentPath, 0, strrpos($parentPath, '/')); $exists = $db->sql_numrows($db->sql_query('SELECT album_id FROM ' . $prefix . '_igallery_albums WHERE album_folder=\'' . $albumRelativePath . '\'')); if (!$exists) { if (!empty($parentPath)) { $parentId = $db->sql_fetchrow($db->sql_query('SELECT album_id FROM ' . $prefix . '_igallery_albums WHERE album_folder=\'' . $parentPath . '\' LIMIT 0,1')); } else { $parentId = 1; } $right = updateNodes($parentId); if ($right[0]) { // Insert new category $sql = 'INSERT INTO ' . $prefix . '_igallery_albums values (\'\', \'' . $right[0] . '\', \'' . ($right[0] + 1) . '\', \'0\', \'' . $albumName . '\', \'\', \'' . $albumRelativePath . '\', \'\', \'' . time() . '\') ;'; if ($result = $db->sql_query($sql)) { if (!file_exists($thumbsRealPath . $albumRelativePath)) { @mkdir($thumbsRealPath . $albumRelativePath); } echo _IG_ADDEDALBUM . ' <b>' . $albumName . '</b>... ' . $albumRelativePath . '/<br />' . PHP_EOL; } } } } echo '<hr />' . PHP_EOL; $row = $db->sql_query('SELECT album_id, album_folder FROM ' . $prefix . '_igallery_albums;'); while ($result = $db->sql_fetchrow($row)) { $albumId = $result['album_id']; $folderName = $result['album_folder']; if (is_dir($picturesRealPath . $folderName)) { if ($dir2 = opendir($picturesRealPath . $folderName)) { while (($picture = readdir($dir2)) !== false) { if (preg_match('#^(.*)\\.(' . allowedExt('preg') . ')$#i', $picture) && is_file($picturesRealPath . $folderName . '/' . $picture) && $picture !== "." && $picture !== "..") { $current = $db->sql_numrows($db->sql_query('SELECT picture_id FROM ' . $prefix . '_igallery_pictures WHERE picture_file=\'' . $picture . '\' AND album_id=\'' . $albumId . '\'')); if ($current == 0 && $picture !== ' .' && $picture !== '. .' && !is_dir($picture)) { $result = $db->sql_query('INSERT INTO ' . $prefix . '_igallery_pictures VALUES(NULL, \'' . $albumId . '\', \'' . $picture . '\', \'\', \'' . $picture . '\', 0, 0, \'' . time() . '\', \'' . $submitter . '\', 0, 0, \'\')'); if ($result) { echo _IG_ADDEDPIC . ' <b>' . $folderName . '/' . $picture . '</b><br />' . PHP_EOL; } else { echo _IG_ADDEDPICFAIL . ' <b>' . $folderName . '/' . $picture . '</b>... ' . mysql_error() . '<br />' . PHP_EOL; } createThumb($moduleName, $folderName, $picture); } } } closedir($dir2); } } } echo '<br /><center><b>' . _IG_QUICKADDFINISHED . '</b></center><br />'; }
function galSettings() { global $db, $prefix, $admin_file, $iConfig, $modname, $ver, $moduleName; $galleryTitle = $iConfig['igallery_title']; $absPath = $iConfig['gallery_abs_path']; $picturesPath = $iConfig['pictures_path']; $thumbsPath = $iConfig['thumbs_path']; $uploadPath = $iConfig['upload_path']; $allowExt = $iConfig['ext_allow']; $showRows = $iConfig['show_rows']; $showColumns = $iConfig['show_columns']; $showDetails = $iConfig['show_details']; $uploadsResize = $iConfig['upload_resize']; $uploadsAutoSize = $iConfig['upload_autosize']; $uploadMaxQuality = $iConfig['max_quality']; $thumbsAutoSize = $iConfig['thumbs_autosize']; $thumbsQuality = $iConfig['thumbs_quality']; $thumbsFormat = $iConfig['thumbs_format']; $allowComments = $iConfig['comments_allow']; $commentsPublic = $iConfig['comments_public']; $popCount = $iConfig['pop_count']; $tooltipTheme = $iConfig['tooltip_theme']; $help = 'modules/' . $moduleName . '/images/help.png'; $inlineJS = '<script type="text/javascript">' . PHP_EOL; $inlineJS .= ' $(document).ready(function() {' . PHP_EOL; $inlineJS .= ' var options = {' . PHP_EOL; $inlineJS .= ' target: \'#settings-alert\',' . PHP_EOL; $inlineJS .= ' url: \'' . $admin_file . '.php?op=galSettingsSaveAjax\',' . PHP_EOL; $inlineJS .= ' success: function() {' . PHP_EOL; $inlineJS .= ' $(\'#settings-alert\').fadeIn(\'slow\');' . PHP_EOL; $inlineJS .= ' }' . PHP_EOL; $inlineJS .= ' };' . PHP_EOL; $inlineJS .= ' $(\'#settings-form\').ajaxForm(options);' . PHP_EOL; $inlineJS .= '});' . PHP_EOL; $inlineJS .= '</script>' . PHP_EOL; AddJSToHead('includes/jquery/jquery.js', 'file'); AddJSToHead('modules/' . $moduleName . '/includes/jquery/jquery.form.js', 'file'); AddJSToHead($inlineJS, 'inline'); include 'header.php'; galAdminMenu(); OpenTable(); echo '<h2 style="text-align:center;">' . $modname . ' ' . $ver . ': ' . _IG_ADM_SETTINGS . '</h2>' . PHP_EOL; echo '<div style="text-align:center;">Hover over <img src="' . $help . '" alt="" /> for additional help.</div>' . PHP_EOL; echo '<div id="gal-settings">' . PHP_EOL; echo ' <form id="settings-form" action="' . $admin_file . '.php?op=galSettingsSave" method="post">' . PHP_EOL; echo ' <p>' . PHP_EOL; echo ' <img src="' . $help . '" alt="" />' . PHP_EOL; echo ' <label for="igallery_title">' . _IG_ADM_IGTITLE . '</label>' . PHP_EOL; echo ' <input type="text" name="igallery_title" id="igallery_title" value="' . $galleryTitle . '" />' . PHP_EOL; echo ' </p>' . PHP_EOL; echo ' <p>' . PHP_EOL; echo ' <img src="' . $help . '" alt="" />' . PHP_EOL; echo ' <label for="gallery_abs_path">' . _IG_ADM_ABSPATH . '</label>' . PHP_EOL; echo ' <input type="text" name="gallery_abs_path" id="gallery_abs_path" value="' . $absPath . '" />' . PHP_EOL; echo ' </p>' . PHP_EOL; echo ' <p>' . PHP_EOL; echo ' <img src="' . $help . '" alt="" />' . PHP_EOL; echo ' <label for="pictures_path">' . _IG_ADM_PICSPATH . '</label>' . PHP_EOL; echo ' <input type="text" name="pictures_path" id="pictures_path" value="' . $picturesPath . '" />' . PHP_EOL; echo ' </p>' . PHP_EOL; echo ' <p>' . PHP_EOL; echo ' <img src="' . $help . '" alt="" />' . PHP_EOL; echo ' <label for="thumbs_path">' . _IG_ADM_THUMBSPATH . '</label>' . PHP_EOL; echo ' <input type="text" name="thumbs_path" id="thumbs_path" value="' . $thumbsPath . '" />' . PHP_EOL; echo ' </p>' . PHP_EOL; echo ' <p>' . PHP_EOL; echo ' <img src="' . $help . '" alt="" />' . PHP_EOL; echo ' <label for="upload_path">' . _IG_ADM_UPLOADPATH . '</label>' . PHP_EOL; echo ' <input type="text" name="upload_path" id="upload_path" value="' . $uploadPath . '" />' . PHP_EOL; echo ' </p>' . PHP_EOL; echo ' <p>' . PHP_EOL; echo ' <img src="' . $help . '" alt="" />' . PHP_EOL; echo ' <label for="ext_allow">' . _IG_ADM_ALLOWEXT . '</label>' . PHP_EOL; echo ' <input type="text" name="ext_allow" id="ext_allow" value="' . $allowExt . '" />' . PHP_EOL; echo ' </p>' . PHP_EOL; echo ' <p>' . PHP_EOL; echo ' <img src="' . $help . '" alt="" />' . PHP_EOL; echo ' <label for="show_rows">' . _IG_ADM_SHOWROWS . '</label>' . PHP_EOL; echo ' <input type="text" name="show_rows" id="show_rows" value="' . $showRows . '" />' . PHP_EOL; echo ' </p>' . PHP_EOL; echo ' <p>' . PHP_EOL; echo ' <img src="' . $help . '" alt="" />' . PHP_EOL; echo ' <label for="show_columns">' . _IG_ADM_SHOWCOLS . '</label>' . PHP_EOL; echo ' <input type="text" name="show_columns" id="show_columns" value="' . $showColumns . '" />' . PHP_EOL; echo ' </p>' . PHP_EOL; /*echo ' <p>'.PHP_EOL; echo ' <img src="'.$help.'" alt="" />'.PHP_EOL; echo ' <label for="show_details">'._IG_ADM_SHOWDETAILS.'</label>'.PHP_EOL; if($showDetails) { echo ' <input type="radio" name="show_details" id="show_details" value="1" checked="checked" />'._YES.' '.PHP_EOL; echo ' <input type="radio" name="show_details" value="0" />'._NO.' '.PHP_EOL; } else { echo ' <input type="radio" name="show_details" id="show_details" value="1" />'._YES.' '.PHP_EOL; echo ' <input type="radio" name="show_details" value="0" checked="checked" />'._NO.' '.PHP_EOL; } echo ' </p>'.PHP_EOL;*/ echo ' <p>' . PHP_EOL; echo ' <img src="' . $help . '" alt="" />' . PHP_EOL; echo ' <label for="upload_resize">' . _IG_ADM_UPLOADRESIZE . '</label>' . PHP_EOL; if ($uploadsResize) { echo ' <input type="radio" name="upload_resize" id="upload_resize" value="1" checked="checked" />' . _YES . ' ' . PHP_EOL; echo ' <input type="radio" name="upload_resize" value="0" />' . _NO . ' ' . PHP_EOL; } else { echo ' <input type="radio" name="upload_resize" id="upload_resize" value="1" />' . _YES . ' ' . PHP_EOL; echo ' <input type="radio" name="upload_resize" value="0" checked="checked" />' . _NO . ' ' . PHP_EOL; } echo ' </p>' . PHP_EOL; echo ' <p>' . PHP_EOL; echo ' <img src="' . $help . '" alt="" />' . PHP_EOL; echo ' <label for="upload_autosize">' . _IG_ADM_UPLOADAUTOSIZE . '</label>' . PHP_EOL; echo ' <input type="text" name="upload_autosize" id="upload_autosize" value="' . $uploadsAutoSize . '" />' . PHP_EOL; echo ' </p>' . PHP_EOL; echo ' <p>' . PHP_EOL; echo ' <img src="' . $help . '" alt="" />' . PHP_EOL; echo ' <label for="max_quality">' . _IG_ADM_MAXQUALITY . '</label>' . PHP_EOL; echo ' <input type="text" name="max_quality" id="max_quality" value="' . $uploadMaxQuality . '" />' . PHP_EOL; echo ' </p>' . PHP_EOL; echo ' <p>' . PHP_EOL; echo ' <img src="' . $help . '" alt="" />' . PHP_EOL; echo ' <label for="thumbs_autosize">' . _IG_ADM_THUMBAUTOSIZE . '</label>' . PHP_EOL; echo ' <input type="text" name="thumbs_autosize" id="thumbs_autosize" value="' . $thumbsAutoSize . '" />' . PHP_EOL; echo ' </p>' . PHP_EOL; echo ' <p>' . PHP_EOL; echo ' <img src="' . $help . '" alt="" />' . PHP_EOL; echo ' <label for="thumbs_quality">' . _IG_ADM_THUMBQUALITY . '</label>' . PHP_EOL; echo ' <input type="text" name="thumbs_quality" id="thumbs_quality" value="' . $thumbsQuality . '" />' . PHP_EOL; echo ' </p>' . PHP_EOL; echo ' <p>' . PHP_EOL; echo ' <img src="' . $help . '" alt="" />' . PHP_EOL; echo ' <label for="thumbs_format">' . _IG_ADM_THUMBSFORMAT . '</label>' . PHP_EOL; $formats = array('JPG', 'PNG'); echo ' <select name="thumbs_format" id="thumbs_format">' . PHP_EOL; foreach ($formats as $option) { if ($option == $thumbsFormat) { echo ' <option value="' . $option . '" selected="selected">' . $option . '</option>' . PHP_EOL; } else { echo ' <option value="' . $option . '">' . $option . '</option>' . PHP_EOL; } } echo ' </select>' . PHP_EOL; echo ' </p>' . PHP_EOL; echo ' <p>' . PHP_EOL; echo ' <img src="' . $help . '" alt="" />' . PHP_EOL; echo ' <label for="tooltip_theme">' . _IG_ADM_TOOLTIP_THEME . '</label>' . PHP_EOL; echo ' <select name="tooltip_theme" id="tooltip_theme">' . PHP_EOL; $tooltipThemeList = scanAlbums('modules/' . $moduleName . '/includes/jquery/jquery.tooltip/themes/', false); if (is_array($tooltipThemeList)) { natsort($tooltipThemeList); foreach ($tooltipThemeList as $theme) { $displayThemeName = basename($theme); if ($displayThemeName == $tooltipTheme) { echo ' <option value="' . $displayThemeName . '" selected="selected">' . $displayThemeName . '</option>' . PHP_EOL; } else { echo ' <option value="' . $displayThemeName . '">' . $displayThemeName . '</option>' . PHP_EOL; } } } echo ' </select>' . PHP_EOL; echo ' </p>' . PHP_EOL; echo ' <p>' . PHP_EOL; echo ' <img src="' . $help . '" alt="" />' . PHP_EOL; echo ' <label for="comments_allow">' . _IG_ADM_ALLOWCOMMENTS . '</label>' . PHP_EOL; if ($allowComments) { echo ' <input type="radio" name="comments_allow" id="comments_allow" value="1" checked="checked" />' . _YES . ' ' . PHP_EOL; echo ' <input type="radio" name="comments_allow" value="0" />' . _NO . ' ' . PHP_EOL; } else { echo ' <input type="radio" name="comments_allow" id="comments_allow" value="1" />' . _YES . ' ' . PHP_EOL; echo ' <input type="radio" name="comments_allow" value="0" checked="checked" />' . _NO . ' ' . PHP_EOL; } echo ' </p>' . PHP_EOL; echo ' <p>' . PHP_EOL; echo ' <img src="' . $help . '" alt="" />' . PHP_EOL; echo ' <label for="comments_public">' . _IG_COMMENTSPUBLIC . '</label>' . PHP_EOL; if ($commentsPublic) { echo ' <input type="radio" name="comments_public" id="comments_public" value="1" checked="checked" />' . _YES . ' ' . PHP_EOL; echo ' <input type="radio" name="comments_public" value="0" />' . _NO . ' ' . PHP_EOL; } else { echo ' <input type="radio" name="comments_public" id="comments_public" value="1" />' . _YES . ' ' . PHP_EOL; echo ' <input type="radio" name="comments_public" value="0" checked="checked" />' . _NO . ' ' . PHP_EOL; } echo ' </p>' . PHP_EOL; echo ' <p>' . PHP_EOL; echo ' <img src="' . $help . '" alt="" />' . PHP_EOL; echo ' <label for="pop_count">' . _IG_ADM_POPCOUNT . '</label>' . PHP_EOL; echo ' <input type="text" name="pop_count" id="pop_count" value="' . $popCount . '" />' . PHP_EOL; echo ' </p>' . PHP_EOL; echo ' <p align="center">' . PHP_EOL; echo ' <input type="submit" value="' . _SAVE . '" />' . PHP_EOL; echo ' </p>' . PHP_EOL; echo ' </form>' . PHP_EOL; echo '</div>' . PHP_EOL; echo '<div id="settings-alert"></div>' . PHP_EOL; CloseTable(); include 'footer.php'; }