} else { $run4 = 0; $w = $x[$cs_voted[$run]['usersgallery_id']] / $y[$cs_voted[$run]['usersgallery_id']]; $z[$run4] = array("usersgallery_id" => $cs_voted[$run]['usersgallery_id'], "folders_id" => $cs_voted[$run]['folders_id'], "voted_answer" => $w); $run4++; } } $z_loop = empty($z) ? 0 : count($z); if ($z_loop > $rows) { $run_to = $rows; } else { $run_to = $z_loop; } $cs_gallery_move = cs_gallery_move($z, $options['list_sort']); if (!empty($z)) { $z = cs_array_sort($cs_gallery_move, SORT_ASC, 'voted_answer'); } for ($run = 0; $run < $run_to; $run++) { $vote[$run]['img'] = $z[$run]['usersgallery_id']; $cs_lap = cs_html_img('symbols/gallery/nowatermark.gif', '100', '100'); $more = 'id=' . $id . '&cat_id=' . $z[$run]['folders_id']; $more .= '&move=' . $z[$run]['move']; $vote[$run]['link'] = cs_link($cs_lap, 'usersgallery', 'com_view', $more); } $data['vote'] = !empty($vote) ? $vote : ''; } } $vote_1['0']['vote'] = empty($data['vote']) ? '' : '1'; $data['vote_1'] = !empty($vote_1['0']['vote']) ? $vote_1 : ''; } else { $from = 'usersgallery';
function make_folders_array($array) { $var = ''; if (!empty($array)) { $array = cs_array_sort($array, SORT_ASC, 'folders_position'); $loop = count($array); for ($run = 0; $run < $loop; $run++) { $folders_id = $array[$run]['folders_id']; if ($array[$run]['sub_id'] == 0) { $last_id = $array[$run]['folders_id']; $var[] = array('depht' => 0, 'folders_id' => $array[$run]['folders_id'], 'position' => $array[$run]['folders_position'], 'name' => $array[$run]['folders_name'], 'sub_id' => $array[$run]['sub_id']); $cache = make_subfolders_array($array, $last_id); if (!empty($cache)) { $var[] = $cache; } } } return $var; } }
$vote = array(); $count_temp = count($temp); for ($run = 1; $run < $count_temp; $run++) { $answer_count = 0; for ($run_2 = 0; $run_2 < $voted_loop; $run_2++) { $voted_answer = $cs_voted[$run_2]['voted_answer']; $voted_fid = $cs_voted[$run_2]['voted_fid']; if ($voted_answer == $run and $voted_fid == $cs_votes_id) { $answer_count++; } } $num = $run - 1; $vote[$num] = array('count' => $answer_count, 'answer' => $temp[$run]); } if ($sort !== 0) { $vote = cs_array_sort($vote, $order['1'], $order['0']); } $vote_loop = count($vote); for ($run = 0; $run < $vote_loop; $run++) { if (!empty($voted_loop)) { $answer_proz = $vote[$run]['count'] / $answers_count * 100; } else { $answer_proz = '0'; } $answer_proz = round($answer_proz, 1); if (!empty($vote[$run]['count'])) { $cs_votes_tpl['answers'][$run]['end_img'] = cs_html_img('symbols/votes/vote02.png', '13', '2'); } else { $cs_votes_tpl['answers'][$run]['end_img'] = ''; } $cs_votes_tpl['answers'][$run]['answer'] = $vote[$run]['answer'];
} } else { $run4 = 0; $w = $x[$cs_gallery_voted[$run]['gallery_id']] / $y[$cs_gallery_voted[$run]['gallery_id']]; $z[$run4] = array("gallery_id" => $cs_gallery_voted[$run]['gallery_id'], "voted_answer" => $w); $run4++; } } $z_loop = empty($z) ? 0 : count($z); if ($z_loop > $rows) { $run_to = $rows; } else { $run_to = $z_loop; } if (!empty($z)) { $z = cs_array_sort($z, SORT_ASC, 'voted_answer'); } for ($run = 0; $run < $run_to; $run++) { $vote[$run]['img'] = $z[$run]['gallery_id']; $cs_lap = cs_html_img('symbols/gallery/nowatermark.gif', '100', $options['thumbs']); $vote[$run]['link'] = cs_link($cs_lap, 'gallery', 'com_view', 'where=' . $vote[$run]['img']); } $data['vote'] = !empty($vote) ? $vote : ''; } } } $vote_1['0']['vote'] = empty($data['vote']) ? '' : '1'; $data['vote_1'] = !empty($vote_1['0']['vote']) ? $vote_1 : ''; $data['tmp']['no_cat'] = empty($no_cat) ? '' : cs_subtemplate(__FILE__, $no_cat, 'usersgallery', 'users_error_1'); $data['cat'] = !empty($cat) ? $cat : array(); if (empty($cat)) {