<?php // ------------------------------------------------------------------------- $TemplateDir = PICMAN_DEFAULT_TEMP; $num_total_pages = 1; $prev_page_href = ''; $prev_page_text = ''; $next_page_href = ''; $next_page_text = ''; $temp = db_fetch_array(db_query("\nSELECT P.template AS template\nFROM {categories} P, {categories} C\nWHERE C.id = {$page_id} AND P.lnum <= C.lnum AND P.rnum >= C.rnum AND P.template != ''\nORDER BY P.lnum DESC\nLIMIT 1\n")); if (!empty($temp['template']) && is_dir(PICMAN_TEMPLATE_DIR . $temp['template'])) { $TemplateDir = $temp['template']; } $cat = db_fetch_array(db_query("SELECT description FROM {categories} WHERE id = {$page_id}")); $group_temp = LoadTemplateFile(PICMAN_TEMPLATE_DIR . $TemplateDir . '/' . 'cat.html'); $content_cat = GetCatContent($page_id, LoadTemplateFile(PICMAN_TEMPLATE_DIR . $TemplateDir . '/' . 'cat_itemcat.html'), LoadTemplateFile(PICMAN_TEMPLATE_DIR . $TemplateDir . '/' . 'cat_itemcat_pre.html'), LoadTemplateFile(PICMAN_TEMPLATE_DIR . $TemplateDir . '/' . 'cat_itemcat_post.html'), LoadTemplateFile(PICMAN_TEMPLATE_DIR . $TemplateDir . '/' . 'cat_itemcat_prerow.html'), LoadTemplateFile(PICMAN_TEMPLATE_DIR . $TemplateDir . '/' . 'cat_itemcat_postrow.html')); list($content_grp, $pagesel_grp) = GetGrpContent($page_id, LoadTemplateFile(PICMAN_TEMPLATE_DIR . $TemplateDir . '/' . 'cat_itemgr.html'), LoadTemplateFile(PICMAN_TEMPLATE_DIR . $TemplateDir . '/' . 'cat_itemgr_pre.html'), LoadTemplateFile(PICMAN_TEMPLATE_DIR . $TemplateDir . '/' . 'cat_itemgr_post.html'), LoadTemplateFile(PICMAN_TEMPLATE_DIR . $TemplateDir . '/' . 'cat_itemgr_prerow.html'), LoadTemplateFile(PICMAN_TEMPLATE_DIR . $TemplateDir . '/' . 'cat_itemgr_postrow.html')); if ($num_total_pages > 1) { if ($page_pg && $page_pg < $num_total_pages) { $next_page_href = sprintf(PICMAN_MAIN . "i%03dp%03d.html", $page_id, $page_pg + 1); $next_page_text = LoadTemplateFile(PICMAN_TEMPLATE_DIR . $TemplateDir . '/' . 'group_next.html'); } if ($page_pg && $page_pg > 1) { $prev_page_href = sprintf(PICMAN_MAIN . "i%03dp%03d.html", $page_id, $page_pg - 1); $prev_page_text = LoadTemplateFile(PICMAN_TEMPLATE_DIR . $TemplateDir . '/' . 'group_prev.html'); } } echo UpdateTemplate($group_temp, array('title' => '', 'topcat' => GetTopCatsForCat($page_id), 'prevhref' => $prev_page_href, 'prevname' => $prev_page_text, 'nexthref' => $next_page_href, 'nextname' => $next_page_text, 'categories' => $content_cat, 'collections' => empty($content_grp) ? '<img src="' . DEFAULT_INDEX_IMAGE . '" width=200 height=10 />' : $content_grp, 'pagesel' => $pagesel_grp, 'desc' => $cat['description'], 'imgdir' => PICMAN_TEMPLATE_IMG . $TemplateDir, 'catdir' => PICMAN_IMAGE . $PICMAN_INFO['dircat']));
function GetCatContent($id_cat, $item_txt, $txt_pre, $txt_post, $txt_prerow, $txt_postrow) { $cat = db_fetch_array(db_query("SELECT catcols, catrows FROM {categories} WHERE id = {$id_cat}")); if ($cat['catcols'] == 0 || $cat['catrows'] == 0) { $cat['catcols'] = 1; $cat['catrows'] = 8; } $perpage = $cat['catcols'] * $cat['catrows']; /* (SELECT count(*) FROM {collections} G WHERE G.uid_cat = C.uniqid) AS grcount, (SELECT count(*) FROM {links} L WHERE L.uid_cat = C.uniqid) AS lncount, (SELECT max(G.date_create) FROM {collections} G WHERE G.uid_cat = C.uniqid) AS dcreate */ $result = db_query("\n\tSELECT\n\t\tC.id AS id, C.name AS name, C.lnum AS lnum\n\tFROM {categories} C\n\tWHERE C.id_parent = {$id_cat} AND C.hidden = 0\n\tORDER BY lnum\n\t"); $txt = ''; if ($num = db_num_rows($result)) { $txt .= $txt_pre; for ($rec = 0; $rec < $num; $rec++) { $item = db_fetch_array($result); $count = $item['grcount'] + $item['lncount']; if ($rec % $cat['catcols'] == 0) { $txt .= $txt_prerow; } $txt .= UpdateTemplate($item_txt, array('href' => sprintf(PICMAN_MAIN . "i%03dp%03d.html", $item['id'], 1), 'name' => $item['name'], 'count' => $count ? $count : '', 'date' => !empty($item['dcreate']) ? date('Y-m-d', strtotime($item['dcreate'])) : '')); if ($rec % $cat['catcols'] == $cat['catcols'] - 1 || $rec == $num - 1) { $txt .= $txt_postrow; } } $txt .= $txt_post; } return $txt; }
if ($page_pg && $page_pg < $item['quantity']) { $next_href = sprintf(PICMAN_PICTURE . "i%03dp%03d.html", $page_id, $page_pg + 1); $next_name = LoadTemplateFile(PICMAN_TEMPLATE_DIR . $TemplateDir . '/' . 'group_next.html'); } elseif ($page_pg == $item['quantity']) { $next_href = sprintf(PICMAN_PICTURE . "i%03dp%03d.html", $page_id, $page_pg); } if ($page_pg && $page_pg > 1) { $prev_href = sprintf(PICMAN_PICTURE . "i%03dp%03d.html", $page_id, $page_pg - 1); $prev_name = LoadTemplateFile(PICMAN_TEMPLATE_DIR . $TemplateDir . '/' . 'group_prev.html'); } $picdir = preg_replace('/[\\/]+/', '/', PICMAN_IMAGE . "{$imgdir}/" . $item['picsubdir'] . "/"); # echo "[$item['holes']]<BR>"; $mov_holes = 0; // Dodanie numerów których nie ma if (count($picholes)) { $iter = 1; $nr = $page_pg; while ($iter <= $nr) { if (in_array($iter + $item['startnum'] - 1, $picholes)) { $mov_holes++; $nr++; } $iter++; } } // echo "<BR>"; // echo "$mov_holes - $page_pg -- $item['startnum'] -- ".($page_pg + $mov_holes + ($item['startnum'] - 1))."<BR>\n"; $content = sprintf($picdir . $item['pictemp'], $page_pg + $mov_holes + $item['startnum'] - 1); } echo UpdateTemplate($pic_temp, array('title' => "Picture {$page_pg} of " . $item['quantity'], 'cols' => $item['cols'], 'rows' => $item['rows'], 'quantity' => $item['quantity'], 'picnr' => $page_pg, 'topcat' => GetTopCatsForCollection($page_id, $page_pg), 'prevhref' => $prev_href, 'prevname' => $prev_name, 'nexthref' => $next_href, 'nextname' => $next_name, 'image' => $content, 'imgdir' => PICMAN_TEMPLATE_IMG . $TemplateDir));
global $argc, $argv; $nuspecTemplate = "ActionBarSherlock.Standalone.nuspec"; $projectName = "ActionBarSherlock.Standalone"; if ($argc < 2) { echo "Usage : release.sh <version>"; die; } $versionNumber = $argv[$argc - 1]; $nugetDirectory = $versionNumber . "/"; if (!file_exists($nugetDirectory)) { log_error("Missing directory " . $nugetDirectory . " to create nuget package"); } print_log("# Ok let's go !"); print_log("# Updating nuspec file for " . $projectName . " in version " . $versionNumber); $nuspecFile = $nugetDirectory . $nuspecTemplate; UpdateTemplate($nuspecTemplate, $nuspecFile, array('version' => $versionNumber)); move_chdir($nugetDirectory); print_log("# Generating nuget package for " . $projectName . " in version " . $versionNumber); exec_system("nuget pack -Verbosity quiet -NonInteractive"); print_log("# Uploading nuget package " . $projectName . " version " . $versionNumber . " to nuget server"); exec_system("nuget push -Verbosity quiet -NonInteractive *.nupkg"); move_chdir('..'); print_log("# Add new packages to git"); exec_system("git add -f " . $versionNumber . "/*.nupkg"); $commitMessage = "Release nuget package " . $projectName . " in version " . $versionNumber; $commitMessage = str_replace('"', '\\"', $commitMessage); print_log("# Commit packages to git"); $tag = 'v_' . $versionNumber; exec_system('git tag -a ' . $tag . ' -m "Release ' . $projectName . ' in version ' . $versionNumber . '"'); exec_system('git commit -m "' . $commitMessage . '"'); // Push all tags
if (in_array($iter + $img_add, $picholes)) { $mov_holes++; $nr++; } $iter++; } } for ($r = 1; $r <= $item['rows'] && $inum <= $item['quantity']; $r++) { $content .= '<tr valign="middle">'; for ($c = 1; $c <= $item['cols'] && $inum <= $item['quantity']; $c++) { if (count($picholes)) { while (in_array($inum + $img_add + $mov_holes, $picholes)) { $img_add++; } } $icon_num = $inum + $img_add + $mov_holes; $href_num = in_array('LI', $group_options) ? $icon_num : $inum; $icon_thumb = sprintf($item['thumbtemp'], $icon_num); $content .= UpdateTemplate($icon_temp, array('href' => sprintf($href, $href_num), 'icon' => is_file($absidir . $icon_thumb) ? $icondir . $icon_thumb : DEFAULT_THUMB_ICON)); $inum++; } $content .= '</tr>' . "\n"; } } else { $content = 'Jesteśmy na stronie index'; } } $catdir = PICMAN_IMAGE . GetDirForCat(0, $page_id); $grpdir = $catdir . '/' . $item['coldir'] . '/'; echo UpdateTemplate($group_temp, array('prevhref' => $prev_href, 'prevname' => $prev_name, 'nexthref' => $next_href, 'nextname' => $next_name, 'title' => $item['title'], 'header' => $item['header'], 'desc' => $item['description'], 'cols' => $item['cols'], 'rows' => $item['rows'], 'dateupdate' => date('Y-m-d', strtotime($item['date_create'])), 'quantity' => $item['quantity'], 'indeximg' => $indeximg, 'topcat' => GetTopCatsForCollection($page_id, $page_num), 'pagesel' => $pagesel, 'content' => $content, 'imgdir' => PICMAN_TEMPLATE_IMG . $TemplateDir, 'catdir' => $catdir, 'grpdir' => $grpdir));
} $picdir = preg_replace('/[\\/]+/', '/', PICMAN_IMAGE . "{$imgdir}/" . $item['picsubdir'] . "/"); $mov_holes = 0; // Dodanie numerów których nie ma if (count($picholes)) { $iter = 1; $nr = $page_pg; while ($iter <= $nr) { if (in_array($iter + $item['startnum'] - 1, $picholes)) { $mov_holes++; $nr++; } $iter++; } } $list = ''; $img_add = 0; $inum = $item['startnum']; for ($pic = 0; $pic < $item['quantity']; $pic++) { if (count($picholes)) { while (in_array($inum + $img_add + $pic, $picholes)) { $img_add++; } } $picnum = $inum + $pic + $img_add; $list .= sprintf("Pic[%d] = '%s'\n", $pic, sprintf($picdir . $item['pictemp'], $picnum)); } $content = sprintf($picdir . $item['pictemp'], $page_pg + $mov_holes + $item['startnum'] - 1); } echo UpdateTemplate($pic_temp, array('title' => "Slide Show", 'cols' => $item['cols'], 'rows' => $item['rows'], 'quantity' => $item['quantity'], 'picnr' => $page_pg, 'image' => $content, 'imgdir' => PICMAN_TEMPLATE_IMG . $TemplateDir, 'picslist' => $list, 'time' => $time, 'startpic' => $page_pg - 1, 'endshow' => sprintf(PICMAN_COLLECTION . "i%03d.html", $page_id)));
echo "Are you sure ? (y/n) "; $confirmChar = trim(readline()); if ($confirmChar != "y") { die; } echo "Ok let's go !" . PHP_EOL; echo "# Creating release branch from develop" . PHP_EOL; $branchName = 'release/' . implode('_', $releases) . '_v' . $versionNumber; exec_system('git checkout -b ' . $branchName . ' develop'); foreach ($releases as $releaseName) { $directory = $directories[$releaseName]; echo "# Updating nuspec file for " . $directory . PHP_EOL; $path = 'nuget_build/' . $directory; $nuspecFile = $path . '/' . $directory . '.nuspec'; $templateFile = $path . '.nuspec.template'; UpdateTemplate($templateFile, $nuspecFile, array('id' => $directory, 'author' => 'Julien Mialon', 'version' => $versionNumber)); exec_system("git add " . $nuspecFile); move_chdir($path); echo "Generating nuget package for " . $directory . " version " . $versionNumber . PHP_EOL; exec_system("nuget pack -Verbosity quiet -NonInteractive"); echo "Uploading nuget package " . $directory . " version " . $versionNumber . " to nuget server" . PHP_EOL; exec_system("nuget push -Verbosity quiet -NonInteractive *.nupkg"); exec_system("mv *.nupkg ../../nuget_packages"); move_chdir('../..'); } echo "Add new packages to git" . PHP_EOL; exec_system("git add -f nuget_packages/*.nupkg"); $commitMessage = "Build file for release " . implode(' & ', $releases) . " in version " . $versionNumber; $commitMessage = str_replace('"', '\\"', $commitMessage); echo "Commit packages to git" . PHP_EOL; $tags = array();