set_filenames(array( 'juza' => 'theme/Juza/script.tpl', 'juzabar' => 'theme/Juza/Juzabar.tpl', 'juzaconfig' => 'theme/Juza/include/Juzaconfig.tpl', )); include_once(PHPWG_ROOT_PATH.'include/menubar.inc.php'); $template->parse('juza'); $template->parse('juzabar'); $template->parse('juzaconfig'); } function Juza_file($src) { global $conf; $remove = (isset($conf['thumbnail_dir'])) ? $conf['thumbnail_dir']:'thumbnail'; $remove .= '/' . $conf['prefix_thumbnail']; $remove = '#' . addslashes( $remove ) . '#'; $file = preg_replace( $remove, '', $src, 1 ); $pos = strrpos( $file , '.'); $ext = substr($file,$pos); $file_wo_ext = substr($file,0,$pos); if (is_file($file)) return $file; /* 80% have the same file extension */ if ($ext <> 'jpg') { if (is_file($file_wo_ext . 'jpg')) return $file;/* 90% */ } if ($ext <> 'JPG') { if (is_file($file_wo_ext . 'JPG')) return $file;/* 8% */ } if ($ext <> 'png') { if (is_file($file_wo_ext . 'png')) return $file;/* 1.8% */ } if ($ext <> 'PNG') { if (is_file($file_wo_ext . 'PNG')) return $file;/* 0.1% */ } if ($ext <> 'jpeg') { if (is_file($file_wo_ext . 'jpeg')) return $file;/* or 50% */ } if ($ext <> 'JPEG') { if (is_file($file_wo_ext . 'JPEG')) return $file;/* or 40% */ } if ($ext <> 'gif') { if (is_file($file_wo_ext . 'gif')) return $file;/* 0.0001% */ } if ($ext <> 'GIF') { if (is_file($file_wo_ext . 'GIF')) return $file;/* 0.0001% */ } return $src; } function Juza_common_tags($max_tags) { $query = ' SELECT t.*, count(*) AS counter FROM '.IMAGE_TAG_TABLE.' INNER JOIN '.TAGS_TABLE.' t ON tag_id = id GROUP BY tag_id ORDER BY counter DESC LIMIT 0,' . $max_tags . ';'; $result = pwg_query($query); $tags = array(); while($row = mysql_fetch_assoc($result)) { array_push($tags, $row); } usort($tags, 'tag_alpha_compare'); return $tags; } function Juza_tags( $ref_back ) { $menu = & $ref_back[0]; $block = $menu->get_block( 'mbTags' ); if ( count($block->data) > 0 ) return; $tags = Juza_common_tags(10); $tags = add_level_to_tags($tags); foreach ($tags as $tag) { $block->data[] = array_merge( str_replace(' ', ' ', $tag), array( 'URL' => make_index_url( array( 'tags' => array($tag) ) ), 'U_ADD' => make_index_url( array( 'tags' => array($tag) ) ), ) ); } $block->template = 'menubar_tags.tpl'; } function Juza_update() { global $template, $conf, $user; $conf_Juza = Juza_default(); if (isset($conf['Juza Config'])) $conf_Juza = array_merge($conf_Juza, unserialize($conf['Juza Config'])); if (isset($_POST['Juza_submit'])) { $conf_Juza['Juza_width'] = isset($_POST['Juza_width']) ? (integer)$_POST['Juza_width'] : 885; $conf_Juza['Juza_width'] = ($conf_Juza['Juza_width'] > 885) ? 885 : $conf_Juza['Juza_width']; $conf_Juza['Juza_width'] = ($conf_Juza['Juza_width'] < 300) ? 300 : $conf_Juza['Juza_width']; $conf_Juza['Juza_height'] = isset($_POST['Juza_height']) ? (integer)$_POST['Juza_height'] : 400; $conf_Juza['Juza_height'] = ($conf_Juza['Juza_height'] > 400) ? 400 : $conf_Juza['Juza_height']; $conf_Juza['Juza_height'] = ($conf_Juza['Juza_height'] < 110) ? 110 : $conf_Juza['Juza_height']; $conf_Juza['Juza_shift'] = isset($_POST['Juza_shift']) ? (integer)$_POST['Juza_shift'] : -160; $conf_Juza['Juza_shift'] = ($conf_Juza['Juza_shift'] > 0) ? 0 : $conf_Juza['Juza_shift']; $conf_Juza['Juza_shift'] = ($conf_Juza['Juza_shift'] < -320) ? 320 : $conf_Juza['Juza_shift']; $conf['Juza Config'] = serialize($conf_Juza); $query = 'REPLACE INTO '.CONFIG_TABLE.' SET param = \'Juza Config\', value = \'' . $conf['Juza Config'] . '\', comment = \'Juza Theme Configuration Parameters\';'; pwg_query($query); } if (isset($_POST['Juza_reset'])) { $conf_Juza = Juza_default(); $conf['Juza Config'] = serialize($conf_Juza); $query = 'REPLACE INTO '.CONFIG_TABLE.' SET param = \'Juza Config\', value = \'' . $conf['Juza Config'] . '\', comment = \'Juza Theme Configuration Parameters\';'; pwg_query($query); } $template->assign('Juza_config', true); $user["expand"] = true; $template->assign('Juza_cats', get_categories_menu()); $user["expand"] = false; $template->assign('Juza_width', $conf_Juza['Juza_width']); $template->assign('Juza_height', $conf_Juza['Juza_height']); $template->assign('Juza_height2', 55+$conf_Juza['Juza_height']); $template->assign('Juza_height3', 325+$conf_Juza['Juza_height']); $template->assign('Juza_shift', $conf_Juza['Juza_shift']); $template->assign('Juza_shift2', 150-$conf_Juza['Juza_height']); $template->assign('Juza_shift3', -(12+$conf_Juza['Juza_height'])); } function Juza_default() { return array( 'Juza_width' => 885, 'Juza_height' => 240, 'Juza_shift' => -160,); } ?>