} $init++; } } return $css; } static function show_icons($css) { $html = "<div class='panel panel-default'/>\n"; $html .= "<div class='panel-body'>\n"; $html .= "<div class='row'/>\n"; $i = 0; foreach ($css as $arr => $class) { if ($i == 6) { $i = 0; $html .= "</div><div class='row'>\n"; } $un_class = str_replace('.', '', $class); $html .= "<div class='col-xs-2 col-sm-2 col-md-2 col-lg-2 text-center' style='padding:10px; 0px;'>\n"; $html .= "<i style='font-size:230%;' class='entypo {$un_class}'></i><br/>.entypo {$un_class}"; $html .= "</div>\n"; $i++; } $html .= "</div>\n"; $html .= "</div></div>\n"; return $html; } } $css_file = icon::get_css('entypo.css'); echo icon::show_icons($css_file); require_once THEMES . "templates/footer.php";
function myhashstr($str) { return $str[0] . $str[1] . '/' . $str[2] . $str[3] . '/'; } function MakeDir($path) { if (!file_exists($path)) { MakeDir(dirname($path)); @mkdir($path, 0777); } } $size = intval($_REQUEST['size']) > 0 ? intval($_REQUEST['size']) : 80; $url = $_REQUEST['url']; $md5 = md5($url); $web_path = "/static/data/hash/pic_icon/" . myhashstr($md5); $path = BASEPATH . $web_path; $web_file = $web_path . $md5 . $size . '.gif'; $file = BASEPATH . $web_file; $source_file = BASEPATH . $url; if (!file_exists($file)) { @MakeDir($path); if (file_exists($source_file)) { include_once BASEPATH . '/application/libraries/Icon.php'; $icon = new icon(); $icon->path = $source_file; $icon->size = $size; $icon->dest = $file; $icon->createIcon(); } } header('Location: ' . $web_file);
public function render() { $input = request::input(); $settings = array(); $settings['limit'] = @$input['limit'] ? @intval($input['limit']) : 20; $settings['offset'] = @intval(@$input['offset']); // show starting from this row $settings['orderby'] = isset($input['orderby']) ? $input['orderby'] : $this->list_orderby; // order by column $settings['orderdesc'] = isset($input['orderdesc']) ? $input['orderdesc'] : $this->list_orderdesc; // order direction $settings['took'] = microtime(true); // building sql for select $from = ' FROM ' . $this->list_table . @$this->left_join . ' WHERE 1=1'; // full text search $full_text_search = array(); $gist_columns = array(); if (!empty($input['full_text_search']) && !empty($this->full_text_search_column)) { $full_text_search = db::tsquery($this->full_text_search_column, $input['full_text_search'], '|', true, array(), $this->link); $from .= $full_text_search['where']; } // other where if (!empty($this->where)) { $from .= $this->where; } // getting number of records if (@$this->list_count_rows) { $sql = 'SELECT COUNT(*) as rows_count ' . $from; $result = db::query($sql, '', array(), $this->link); if (@$result['error']) { layout::add_message($result['error'], 'error'); } // use this variable to get number of rows, isset for verification $settings['count_rows'] = @$result['rows'][0]['rows_count'] ? $result['rows'][0]['rows_count'] : 0; } else { // EXPERIMENTAL: increase number of rows fetched by 1 to check whether next row exists $settings['limit']++; } // quering $sql = 'SELECT ' . $this->select . (!empty($full_text_search['rank']) ? ', ' . $full_text_search['rank'] . ' ts_rank2' : '') . $from; $sql .= ' ORDER BY ' . (@$full_text_search['orderby'] ? @$full_text_search['orderby'] . ", " : "") . $settings['orderby'] . ($settings['orderdesc'] ? ' DESC' : ''); $sql .= $settings['limit'] ? ' LIMIT ' . $settings['limit'] : ''; $sql .= $settings['offset'] ? ' OFFSET ' . $settings['offset'] : ''; $result = db::query($sql, '', array(), $this->link); $settings['took'] = round(microtime(true) - $settings['took'], 2); // processing count if (!@$this->list_count_rows) { if (isset($result['rows'][$settings['limit'] - 1])) { $settings['flag_next_row_exists'] = true; } unset($result['rows'][$settings['limit'] - 1]); $settings['limit']--; } $settings['num_rows'] = count($result['rows']); // rendering list $ms = ''; // Hidden elements $ms .= h::hidden(array('name' => 'orderby', 'id' => 'orderby', 'value' => $settings['orderby'])); $ms .= h::hidden(array('name' => 'orderdesc', 'id' => 'orderdesc', 'value' => $settings['orderdesc'])); $ms .= h::hidden(array('name' => 'offset', 'id' => 'offset', 'value' => $settings['offset'])); $ms .= h::hidden(array('name' => 'limit', 'id' => 'limit', 'value' => $settings['limit'])); // if we have no rows if (empty($result['rows'])) { $ms .= 'No records found!'; } else { // main container $header = $this->header($settings); $ms .= $header; $ms .= '<br/>'; $ms .= '<table cellpadding="0" cellspacing="0" class="editor table" width="100%">'; // types $types = model_presets::get('he_post_type'); // rows $row_counter = 1; foreach ($result['rows'] as $k => $v) { $ms .= '<tr>'; $ms .= '<td class="editor cell numeration" valign="top">' . $row_counter . '. </td>'; $ms .= '<td class="editor cell regular" align="left">'; // generating urls $url_post = call_user_func_array($this->url_posts, array($v['type'], $v['post_id'], $v['uri'])); $url_type = call_user_func_array($this->url_type, array($v['type'])); // title with icon goes first $value = $v['title']; if ($v['type'] == 20) { $v['icon'] = 'help16.png'; } else { if ($v['type'] == 10) { $v['icon'] = 'faq16.png'; } } if (!empty($v['icon'])) { $value = icon::render($v['icon']) . ' ' . $value; } $ms .= h::a(array('href' => $url_post, 'value' => $value)); if (isset($v['ts_rank2'])) { $ms .= ' [' . $v['ts_rank2'] . ']'; } // entry type $ms .= ' ' . h::a(array('href' => $url_type, 'value' => $types[$v['type']]['name'], 'style' => 'color:black;')); $ms .= '<br/>'; $ms .= h::a(array('href' => $url_post, 'value' => $url_post, 'style' => 'color: green;')); if (!empty($input['full_text_search'])) { $ms .= '<br/>'; $temp = keywords::highlight($v['body'], $input['full_text_search'], array('<b style="color:red;">', '</b>')); } else { $ms .= '<br/>'; $temp = $v['body']; } $ms .= $temp; $ms .= '<br/>'; $ms .= '<br/>'; $ms .= '</td>'; $ms .= '</tr>'; $row_counter++; } $ms .= '</table>'; $ms .= $header; $ms .= '<br class="clearfloat">'; } return $ms; }