function perform($callback) { global $list, $argv; $args = $argv; array_shift($args); $list = parse_list('images.lst'); if (!$list) { die("Hubo un error\n"); } function show_help() { global $list; echo "Ficheros:\n"; echo implode(', ', array_keys($list)); echo "\n"; exit; } if (!sizeof($args)) { show_help(); } $total = 0; $error = 0; foreach ($args as $ac) { if ($ac == '*') { $ac = array_keys($list); } else { $ac = array($ac); } foreach ($ac as $c) { $cc =& $list[$c]; if (!isset($cc)) { echo "No existe '{$c}'\n"; continue; } try { if (!$callback($c, $cc)) { $error++; } } catch (Exception $e) { echo $e; $error++; } $total++; } } printf("----------------------\n"); printf("Total procesados: %d\n", $total); printf("Total errores : %d\n", $error); }
function parsebbcode($text) { $bbsearch = array('/\\[b](.*?)\\[\\/b]/s', '/\\[i](.*?)\\[\\/i]/s', '/\\[u](.*?)\\[\\/u]/s', '/\\[s](.*?)\\[\\/s]/s', '/\\[url](.*?)\\[\\/url]/s', '/\\[url=(.*?)](.*?)\\[\\/url]/s', '/\\[img=(.*?)](.*?)\\[\\/img]/', '/\\[img](.*?)\\[\\/img]/i', '/\\[spoiler](.*?)\\[\\/spoiler]/s', '/\\[spoiler=(.*?)](.*?)\\[\\/spoiler]/s', '/\\[code](.*?)\\[\\/code]/s', '/\\[code=(.*?)](.*?)\\[\\/code]/s', '/\\[pre](.*?)\\[\\/pre]/s', '/\\[center](.*?)\\[\\/center]/s', '/\\[align=(.*?)](.*?)\\[\\/align]/s', '/\\[color=(.*?)](.*?)\\[\\/color]/s', '/\\[font=(.*?)](.*?)\\[\\/font]/s', '/\\[size=(xx-small|x-small|small|medium|large|x-large|xx-large)\\](.*?)\\[\\/size\\]/s', '/\\[size=(.*?)](.*?)\\[\\/size]/s', '/\\[hr]/'); $bbreplace = array('<b>$1</b>', '<i>$1</i>', '<u>$1</u>', '<s>$1</s>', '<a href=\'$1\'>$1</a>', '<a href=\'$1\'>$2</a>', '<img src=\'$1\' alt="$2" title="$2" />', '<img src=\'$1\' alt="User posted image" />', '<table class=\'bq\'><tr><td class=\'sheader\'><b>Spoiler:</b> <i>(highlight to read)</i></td></tr><tr><td class=\'spoilercell\'>$1</td></tr></table>', '<table class=\'bq\'><tr><td class=\'sheader\'><b>Spoiler about $1:</b> <i>(highlight to read)</i></td></tr><tr><td class=\'spoilercell\'>$2</td></tr></table>', '<table class=\'bq\'><tr><td class=\'sheader\'><b>Code:</b></td></tr><tr><td><pre style=\'margin: 2px\'>$1</pre></td></tr></table>', '<table class=\'bq\'><tr><td class=\'sheader\'><b>Code:</b> <i>($1)</i></td></tr><tr><td><pre style=\'margin: 2px\'>$2</pre></td></tr></table>', '<pre>$1</pre>', '<div align=\'center\'>$1</div>', '<div align=\'$1\'>$2</div>', '<font color=\'$1\'>$2</font>', '<font face=\'$1\'>$2</font>', '<span style=\'font-size: $1\'>$2</span>', '<font size=\'$1\'>$2</font>', '<div class=\'separator\'><hr></div>'); return str_replace('[BBCODE_OVERRIDE]', '[', preg_replace($bbsearch, $bbreplace, parse_quotes(parse_list($text)))); }
} else { $restrict = ''; } pageheader($lang_delete_php['alb_mgr']); starttable("100%", $lang_delete_php['alb_mgr'], 6); $orig_sort_order = parse_list($_POST['sort_order']); foreach ($orig_sort_order as $album) { $op = parse_orig_sort_order($album); if (count($op) == 2) { $query = "UPDATE {$CONFIG['TABLE_ALBUMS']} SET pos='{$op['pos']}' WHERE aid='{$op['aid']}' {$restrict} LIMIT 1"; cpg_db_query($query); } else { cpg_die(sprintf(CRITICAL_ERROR, $lang_delete_php['err_invalid_data'], $_POST['sort_order']), __FILE__, __LINE__); } } $to_delete = parse_list($_POST['delete_album']); foreach ($to_delete as $album_id) { delete_album((int) $album_id); } if (isset($_POST['to'])) { foreach ($_POST['to'] as $option_value) { $op = parse_select_option(stripslashes($option_value)); switch ($op['action']) { case '0': break; case '1': if (GALLERY_ADMIN_MODE) { $category = (int) $_POST['cat']; } else { $category = FIRST_USER_CAT + USER_ID; }
} } //print_r($sort_order_array); /** * $matches = $superCage->post->getMatched('delete_album', '/^[0-9,@]+$/'); * $to_delete = parse_list($matches[0]); * foreach ($to_delete as $album_id) { * $returnOutput .= delete_album((int)$album_id); * } * */ //getting the category to rederecte to ablum manager $categoryTo = $superCage->post->getInt('cat'); if ($superCage->post->keyExists('sort_order_album')) { $to = $superCage->post->getEscaped('sort_order_album'); $option_value = parse_list($to); //print_r($option_value); $j = '0'; $position = 100; foreach ($option_value as $value) { $op = parse_select_option($value); switch ($op['2']) { case '0': break; case '4': $returnOutput .= delete_album((int) $op[0]); break; case '1': $category = $superCage->post->getInt('cat'); $user_id = USER_ID; $returnOutput .= "<tr><td colspan=\"6\" class=\"tableb\">" . sprintf($lang_delete_php['create_alb'], $op['1']) . "</td></tr>\n";
} else { $restrict = ''; } pageheader($lang_delete_php['alb_mgr']); starttable("100%", $lang_delete_php['alb_mgr'], 6); $orig_sort_order = parse_list($HTTP_POST_VARS['sort_order']); foreach ($orig_sort_order as $album) { $op = parse_orig_sort_order($album); if (count($op) == 2) { $query = "UPDATE {$CONFIG['TABLE_ALBUMS']} SET pos='{$op['pos']}' WHERE aid='{$op['aid']}' {$restrict} LIMIT 1"; db_query($query); } else { cpg_die(sprintf(CRITICAL_ERROR, $lang_delete_php['err_invalid_data'], $HTTP_POST_VARS['sort_order']), __FILE__, __LINE__); } } $to_delete = parse_list($HTTP_POST_VARS['delete_album']); foreach ($to_delete as $album_id) { delete_album((int) $album_id); } if (isset($HTTP_POST_VARS['to'])) { foreach ($HTTP_POST_VARS['to'] as $option_value) { $op = parse_select_option(stripslashes($option_value)); switch ($op['action']) { case '0': break; case '1': if (GALLERY_ADMIN_MODE) { $category = (int) $HTTP_POST_VARS['cat']; } else { $category = FIRST_USER_CAT + USER_ID; }
if (isset(${"_" . _STYPE}['action'])) { // Handle post-action if (${"_" . _STYPE}['bsubmit'] == "Run") { switch (${"_" . _STYPE}['action']) { case 0: // Save changes foreach (${"_" . _STYPE}['branch'] as $key => $branch) { $url = ${"_" . _STYPE}['url'][$key]; if ($url != '' && $branch != '') { $source[] = array($branch, $url); } } // Save the changes to file save_list(${"_" . _STYPE}['dir'], $source, ${"_" . _STYPE}['id']); // Then reload the file to propogate the changes list($directory, $sources) = parse_list(); break; case 1: // Pull from sources //$rslt = git_pull_all($directory,$sources); $id = ${"_" . _STYPE}['id']; $rslt = git_pull($directory[$id], $sources[$id]); break; case 2: // Init new repo break; case 3: // Delete this repo break; case 4: // Git log
} else { $options = array(); } if ($args->pretty) { $options['minify'] = false; } foreach (array('boilerplate', 'formatter', 'newlines', 'stat_dump', 'source_map') as $option) { if ($args->{$option}) { $options[$option] = $args->{$option}; } } if ($args->enable_plugins) { $options['plugins'] = parse_list($args->enable_plugins); } if ($args->vendor_target) { $options['vendor_target'] = parse_list($args->vendor_target); } if ($args->vars) { parse_str($args->vars, $in_vars); $options['vars'] = $in_vars; } if ($args->output_file) { $options['output_dir'] = dirname($args->output_file); $options['output_file'] = basename($args->output_file); } $options += array('doc_root' => getcwd(), 'context' => $args->context); ################################################################## ## Output. error_reporting(0); if ($args->watch) { csscrush_set('config', array('io' => 'CssCrush\\IO\\Watch'));