Beispiel #1
0
 function add($host, $name = '', $description = '')
 {
     $host = $this->_host($host);
     if (!$host) {
         return jerror('站点地址host不能为空', -1);
     }
     $p = array('host' => $host, 'name' => $name, 'description' => $description, 'dateline' => TIMESTAMP);
     $id = $this->db->insert($p, 1);
     if ($id < 1) {
         return jerror('添加新的站点地址host失败', -2);
     }
     return jreturn($id);
 }
Beispiel #2
0
 function add($url, $title = '', $description = '')
 {
     $url = $this->_url($url);
     if (!$url) {
         return jerror('URL链接地址不能为空', -1);
     }
     $p = array('url' => $url, 'url_hash' => $this->_hash($url), 'title' => $title, 'description' => $description, 'dateline' => TIMESTAMP);
     $id = $this->db->insert($p, 1);
     if ($id < 1) {
         $this->clear_invalid();
         return jerror('添加新的URL链接地址失败', -2);
     }
     $ret = $this->set_key($id);
     if (!$ret) {
         $this->clear_invalid();
         return jerror('新的URL链接地址key值设置失败', -3);
     }
     $site_info = jlogic('site')->info($url);
     $this->set_site_id($id, $site_info['id']);
     $status = $site_info['status'];
     $status = (int) ($status ? $status : jconf::get('url', 'status_default'));
     $this->set_status($id, $status);
     return jreturn($id);
 }
Beispiel #3
0
function jerror($msg, $code = 0)
{
    $rets = jreturn($msg, 'error', $code);
    $rets['msg'] = $msg;
    return $rets;
}