/** * get method returns an array of banner record objects * * Option: Values * -------------- * bid * limit limits the number of returned records * offset how many records to bypass before returning a record (limit required) * sortBy determines which column the sort takes place * sortDirection (asc, desc) sort ascending or descending (sortBy required) * * Returns (array of objects) * -------------------------- * bid * sort * link * update_time * * @param array $options * @return array result() */ function get($options = array()) { $options = _default(array('sortDirection' => 'desc'), $options); $qualificationArray = array('bid'); foreach ($qualificationArray as $qualifier) { if (isset($options[$qualifier])) { $this->db->where($qualifier, $options[$qualifier]); } } // If limit / offset are declared (usually for pagination) then we need to take them into account if (isset($options['limit']) && isset($options['offset'])) { $this->db->limit($options['limit'], $options['offset']); } else { if (isset($options['limit'])) { $this->db->limit($options['limit']); } } // sort if (isset($options['sortBy'])) { $this->db->order_by($options['sortBy'], $options['sortDirection']); } $query = $this->db->get('banner'); if ($query->num_rows() == 0) { return false; } if ($query->num_rows() == 1) { return $query->row(0); } return $query->result(); }
function setup_default_config() { global $config_values, $platform; function _default($a, $b) { global $config_values; if (!isset($config_values['Settings'][$a])) { $config_values['Settings'][$a] = $b; } } if (!isset($config_values['Settings'])) { $config_values['Settings'] = array(); } // Sensible Defaults $basedir = get_base_dir(); _default('Episode Only', '0'); _default('Combine Feeds', '0'); _default('Transmission Login', ''); _default('Transmission Password', ''); _default('Transmission Host', 'localhost'); _default('Transmission Port', '9091'); _default('Transmission URI', '/transmission/rpc'); _default('Watch Dir', ''); if ($platform == 'NMT') { _default('Download Dir', '/share/Download'); } else { _default('Download Dir', '/mnt/Media/Downloads'); } _default('Cache Dir', $basedir . "/rss_cache/"); _default('TVDB Dir', $basedir . "/tvdb_cache/"); _default('Save Torrents', "0"); _default('Run Torrentwatch', "True"); _default('Client', "Transmission"); _default('Verify Episode', "1"); _default('Only Newer', "1"); _default('Download Proper', "1"); _default('Default Feed All', "1"); _default('Deep Directories', "0"); _default('Require Episode Info', '0'); _default('Disable Hide List', '0'); _default('History', $basedir . "/rss_cache/rss_dl.history"); _default('MatchStyle', "regexp"); _default('Extension', "torrent"); _default('verbosity', '0'); _default('Default Seed Ratio', '-1'); _default('Script', ''); _default('Email Notifications', ''); _default('SMTP Server', 'localhost'); _default('TimeZone', 'UTC'); _default('Sanitize Hidelist', '0'); }
continue; } $hd["list"]["d"]["index"] = ++$_index_d; if ($_index_d >= $_total_d) { $hd["list"]["d"]["last"] = true; } ?> <li> <div class="article"> <a href="http://localhost/v5/cmsweb/hdcms/index.php?<?php echo $d['domain']; ?> "> <img src="<?php echo _default($d['icon'], 'http://localhost/v5/cmsweb/hdcms/data/image/user/50.png'); ?> " onmouseover="user.show(this,<?php echo $d['uid']; ?> )"/> </a> <a href="http://localhost/v5/cmsweb/hdcms/index.php?<?php echo $d['domain']; ?> "> <?php echo $d['username']; ?> </a> <?php
<?php if (!defined("HDPHP_PATH")) { exit; } C("SHOW_NOTICE", FALSE); ?> <div class="hd_user_alert"> <div class="hd_user_icon"> <div class="ico_img"> <a href="http://localhost/v5/cmsweb/hdcms/index.php?<?php echo $field['domain']; ?> "><img src="http://localhost/v5/cmsweb/hdcms/<?php echo _default($field['icon'], 'data/image/user/100.png'); ?> "/></a> </div> </div> <div class="hd_user_info"> <div class="nickname"><?php echo $field['nickname']; ?> </div> <div class="logintime">注册时间:<?php echo date('Y-m-d', $field['regtime']); ?> </div> <div class="lasttime">最后登录:<?php echo date('Y-m-d', $field['logintime']); ?>
echo _default($_GET['comment_id'], 0); ?> '; if(comment_id){ var id = 'c'+comment_id; var _top = $("#"+id).offset().top; $(window).scrollTop(_top); } }) </script> <!--发表评论--> <div class="hd-comment"> <!--评论标题--> <div class="title"> <img src="<?php echo _default($_SESSION['icon'], 'http://localhost/v5/cmsweb/hdcms/data/image/user/50-gray.png'); ?> "/> 发表我的评论 </div> <!--发表评论--> <div class="publish"> <form method="post" onsubmit="return add_comment(this)"> <input type="hidden" name="mid" value="<?php echo $_GET['mid']; ?> "/> <input type="hidden" name="cid" value="<?php echo $_GET['cid']; ?> "/> <input type="hidden" name="aid" value="<?php
/** * getCatalogs method returns an array of catalog record objects * * Option: Values * -------------- * vcid * vcname * parent_id * limit limits the number of returned records * offset how many records to bypass before returning a record (limit required) * sortBy determines which column the sort takes place * sortDirection (asc, desc) sort ascending or descending (sortBy required) * * Returns (array of objects) * -------------------------- * vcid * vcname * description * parent_id * video_counts * create_time * update_time * * @param array $options * @return array result() */ function getCatalogs($options = array()) { // default values $options = _default(array('sortDirection' => 'asc'), $options); // Add where clauses to query $qualificationArray = array('vcid', 'vcname', 'parent_id'); foreach ($qualificationArray as $qualifier) { if (isset($options[$qualifier])) { $this->db->where($qualifier, $options[$qualifier]); } } // If limit / offset are declared (usually for pagination) then we need to take them into account if (isset($options['limit']) && isset($options['offset'])) { $this->db->limit($options['limit'], $options['offset']); } else { if (isset($options['limit'])) { $this->db->limit($options['limit']); } } // sort if (isset($options['sortBy'])) { $this->db->order_by($options['sortBy'], $options['sortDirection']); } $query = $this->db->get('video_catalogs'); if ($query->num_rows() == 0) { return false; } if (isset($options['vcid']) || isset($options['vcname'])) { // If we know that we're returning a singular record, then let's just return the object return $query->row(0); } else { // If we could be returning any number of records then we'll need to do so as an array of objects return $query->result(); } }
<td><?php echo _default($hdcms['email'], '保密'); ?> </td> </tr> <tr> <td>电话:</td> <td><?php echo _default($hdcms['tel'], '保密'); ?> </td> </tr> <tr> <td>作者介绍:</td> <td><?php echo _default($hdcms['about'], '这家伙很懒,没有写介绍'); ?> </td> </tr> </table> <hr /> <h4>模板预览:</h4> <?php $hd["list"]["pic"]["total"] = 0; if (isset($hdcms['pics']['path']) && !empty($hdcms['pics']['path'])) { $_id_pic = 0; $_index_pic = 0; $lastpic = min(1000, count($hdcms['pics']['path'])); $hd["list"]["pic"]["first"] = true; $hd["list"]["pic"]["last"] = false; $_total_pic = ceil($lastpic / 1);
/** * getEbook method returns an array of ebooks record objects * * Option: Values * -------------- * eid * title * etags * ebookcatalog_id * keyword fulltext search of title or description * date_from begin of creation date period search * date_to end of creation date period search * limit limits the number of returned records * offset how many records to bypass before returning a record (limit required) * sortBy determines which column the sort takes place * sortDirection (asc, desc) sort ascending or descending (sortBy required) * * Returns (array of objects) * -------------------------- * eid the ID of the video record that will be updated * title * data * etags * description * ebookcatalog_id * clicks * ebook_thumbnail * ebook_thumbnail_tiny * create_time * update_time * * @param array $options * @return array result() */ function getEbook($options = array()) { // default values $options = _default(array('sortDirection' => 'desc'), $options); // Add where clauses to query $qualificationArray = array('eid', 'title', 'etags', 'ebookcatalog_id', 'author', 'author_unit'); foreach ($qualificationArray as $qualifier) { if (isset($options[$qualifier])) { if (is_array($options[$qualifier])) { $this->db->where($qualifier, array_shift($options[$qualifier])); foreach ($options[$qualifier] as $where) { $this->db->or_where($qualifier, $where); } } else { $this->db->where($qualifier, $options[$qualifier]); } } } // If limit / offset are declared (usually for pagination) then we need to take them into account if (isset($options['limit']) && isset($options['offset'])) { $this->db->limit($options['limit'], $options['offset']); } else { if (isset($options['limit'])) { $this->db->limit($options['limit']); } } // sort if (isset($options['sortBy'])) { $this->db->order_by($options['sortBy'], $options['sortDirection']); } if (isset($options['keyword'])) { $this->db->like('title', $options['keyword']); $this->db->or_like('description', $options['keyword']); } if (isset($options['date_from'])) { $this->db->where('create_time >=', $options['date_from']); } if (isset($options['date_to'])) { $this->db->where('create_time <=', $options['date_to']); } // select if (isset($options['select'])) { $this->db->select($options['select']); } else { $this->db->select('eid, title, etags, author, author_unit,' . 'description, ebookcatalog_id, clicks, create_time, ' . 'update_time'); } $query = $this->db->get('ebooks'); if ($query->num_rows() == 0) { return false; } if (isset($options['eid']) && !isset($options['multi']) || isset($options['data'])) { // If we know that we're returning a singular record, then let's just return the object return $query->row(0); } else { // If we could be returning any number of records then we'll need to do so as an array of objects return $query->result(); } }
/** * getVideo method returns an array of videos record objects * * Option: Values * -------------- * vid * title * youtube_id * vtags * videocatalog_id * keyword fulltext search of title or description * date_from begin of creation date period search * date_to end of creation date period search * limit limits the number of returned records * offset how many records to bypass before returning a record (limit required) * sortBy determines which column the sort takes place * sortDirection (asc, desc) sort ascending or descending (sortBy required) * * Returns (array of objects) * -------------------------- * vid the ID of the video record that will be updated * title * youtube_id * org_source_path * view_source_path * other_source_path * vtags * description * author * vlength * videocatalog_id * clicks * video_thumbnail * video_thumbnail_tiny * create_time * update_time * * @param array $options * @return array result() */ function getVideo($options = array()) { // default values $options = _default(array('sortDirection' => 'desc'), $options); // Add where clauses to query $qualificationArray = array('vid', 'title', 'youtube_id', 'vtags', 'videocatalog_id'); foreach ($qualificationArray as $qualifier) { if (isset($options[$qualifier])) { if (is_array($options[$qualifier])) { $this->db->where($qualifier, array_shift($options[$qualifier])); foreach ($options[$qualifier] as $where) { $this->db->or_where($qualifier, $where); } } else { $this->db->where($qualifier, $options[$qualifier]); } } } // If limit / offset are declared (usually for pagination) then we need to take them into account if (isset($options['limit']) && isset($options['offset'])) { $this->db->limit($options['limit'], $options['offset']); } else { if (isset($options['limit'])) { $this->db->limit($options['limit']); } } // sort if (isset($options['sortBy'])) { $this->db->order_by($options['sortBy'], $options['sortDirection']); } if (isset($options['keyword'])) { $keyword = addslashes($options['keyword']); //$this->db->like('title', $options['keyword']); //$this->db->or_like('description', $options['keyword']); $this->db->where("(`title` LIKE '%{$keyword}%' OR `description` LIKE '%{$keyword}%')"); } if (isset($options['date_from'])) { $date_from = strtotime($options['date_from']); $this->db->where('create_time >=', date('Y-m-d H:i:s', $date_from)); } if (isset($options['date_to'])) { $date_to = strtotime($options['date_to']); $this->db->where('create_time <=', date('Y-m-d H:i:s', $date_to + 86399)); } // select if (isset($options['select'])) { $this->db->select($options['select']); } else { $this->db->select('vid, title, youtube_id, org_source_path, view_source_path, other_source_path, ' . 'vtags, description, author, vlength, videocatalog_id, clicks, create_time, ' . 'update_time'); } //echo $this->db->get_compiled_select('videos');z $query = $this->db->get('videos'); if ($query->num_rows() == 0) { return false; } if (isset($options['vid']) && !isset($options['multi']) || isset($options['youtube_id'])) { // If we know that we're returning a singular record, then let's just return the object return $query->row(0); } else { // If we could be returning any number of records then we'll need to do so as an array of objects if (isset($options['counts'])) { return $query->num_rows(); } else { return $query->result(); } } }
/** * stats method returns an array of video_statics record objects * * Option: Values * -------------- * date_from begin of creation date period search * date_to end of creation date period search * limit limits the number of returned records * offset how many records to bypass before returning a record (limit required) * sortBy determines which column the sort takes place * sortDirection (asc, desc) sort ascending or descending (sortBy required) * * Returns (array of objects) * -------------------------- * vsid * video_id * day_clicks * update_time * * @param array $options * @return array result() */ function stats($options = array()) { if (!_required(array('date_from', 'date_to'), $options)) { return false; } $options = _default(array('sortDirection' => 'asc'), $options); $date_from = strtotime($options['date_from']); $this->db->where('date >=', date('Y-m-d H:i:s', $date_from)); $date_to = strtotime($options['date_to']); $this->db->where('date <=', date('Y-m-d H:i:s', $date_to + 86399)); $this->db->or_where('vid !=', 0); $this->db->group_by('vid'); $this->db->select_sum('day_clicks'); $this->db->select('vid, title, vlength, videocatalog_id, clicks, description, author, create_time'); $this->db->from('videos'); $this->db->join('video_statistics', 'videos.vid = video_statistics.video_id', 'left'); // If limit / offset are declared (usually for pagination) then we need to take them into account if (isset($options['limit']) && isset($options['offset'])) { $this->db->limit($options['limit'], $options['offset']); } else { if (isset($options['limit'])) { $this->db->limit($options['limit']); } } // sort if (isset($options['sortBy'])) { $this->db->order_by($options['sortBy'], $options['sortDirection']); } $query = $this->db->get(); return $query->result(); }