| 1 | <?php |
|---|
| 2 | /******************************************************************************/ |
|---|
| 3 | // // |
|---|
| 4 | // InstantCMS v1.8 // |
|---|
| 5 | // http://www.instantcms.ru/ // |
|---|
| 6 | // // |
|---|
| 7 | // written by InstantCMS Team, 2007-2010 // |
|---|
| 8 | // produced by InstantSoft, (www.instantsoft.ru) // |
|---|
| 9 | // // |
|---|
| 10 | // LICENSED BY GNU/GPL v2 // |
|---|
| 11 | // // |
|---|
| 12 | /******************************************************************************/ |
|---|
| 13 | |
|---|
| 14 | if(!defined('VALID_CMS')) { die('ACCESS DENIED'); } |
|---|
| 15 | |
|---|
| 16 | function icon($icon, $link, $title, $onClick=''){ |
|---|
| 17 | |
|---|
| 18 | if ($onClick==''){ |
|---|
| 19 | $html = '<a class="icon" title="'.$title.'" href="'.$link.'"><img border="0" src="/images/icons/'.$icon.'.png" alt="'.$title.'"></a>'; |
|---|
| 20 | } else { |
|---|
| 21 | $html = '<a class="icon" title="'.$title.'" href="'.$link.'" onClick="'.$onClick.'"><img border="0" src="/images/icons/'.$icon.'.png" alt="'.$title.'"></a>'; |
|---|
| 22 | } |
|---|
| 23 | return $html; |
|---|
| 24 | |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | function inArray($array, $item){ |
|---|
| 28 | |
|---|
| 29 | $found = false; |
|---|
| 30 | foreach($array as $key=>$value){ |
|---|
| 31 | if ($value == $item) { |
|---|
| 32 | $found = true; |
|---|
| 33 | } |
|---|
| 34 | } |
|---|
| 35 | return $found; |
|---|
| 36 | |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | function pagelinks($table, $perpage, $current, $first_url=''){ |
|---|
| 40 | |
|---|
| 41 | $inDB = cmsDatabase::getInstance(); |
|---|
| 42 | |
|---|
| 43 | $result = $inDB->query("SELECT id FROM $table") ; |
|---|
| 44 | $records = $inDB->num_rows($result); |
|---|
| 45 | |
|---|
| 46 | if ($records){ |
|---|
| 47 | $pages = ceil($records / $perpage); |
|---|
| 48 | if($pages>1){ |
|---|
| 49 | echo '<div style="margin-top:10px; margin-bottom: 15px; font-size:10px">'; |
|---|
| 50 | echo '<span style="margin:5px; padding:4px"><strong>Ñòðàíèöû: </strong></span>'; |
|---|
| 51 | for ($p=1; $p<=$pages; $p++){ |
|---|
| 52 | if ($p != $current) { |
|---|
| 53 | if ($first_url == '') { $link = $_SERVER['PHP_SELF'].'?page='.$p; } |
|---|
| 54 | else { $link = $_SERVER['PHP_SELF'].$first_url.'&page='.$p; } |
|---|
| 55 | echo ' <a href="'.$link.'" style="margin:5px; padding:5px">'.$p.'</a> '; |
|---|
| 56 | } else { |
|---|
| 57 | echo '<span style="margin:5px; padding:5px; border:solid 1px silver; background-color: white">'.$p.'</span>'; |
|---|
| 58 | } |
|---|
| 59 | } |
|---|
| 60 | echo '</div>'; |
|---|
| 61 | } |
|---|
| 62 | } |
|---|
| 63 | } |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | ?> |
|---|