Beispiel #1
0
 /**
  * function getGuideDetails returns the array of guide details of given id
  * @param  $id |md5() 
  * @return success/error
  **/
 function getGuideDetails($id)
 {
     $cols = " *,guides_tbl.type as category,guides_tbl.guide_group as subcategory";
     $whr = "blocked='false' AND md5(id)='" . $id . "'";
     $sql = _db()->_selectQ('guides_tbl', $cols, $whr);
     $res = _dbQuery($sql);
     $data = _dbFetch($res);
     if (isset($data['author'])) {
         $data['authorid'] = extractUserID($data['author']);
     } else {
         $data['authorid'] = "";
     }
     if (isset($data['creator'])) {
         $data['creatorid'] = extractUserID($data['creator']);
     } else {
         $data['creatorid'] = "";
     }
     if ($data['authorid'] == $_SESSION['SESS_USER_ID'] || $data['creatorid'] == $_SESSION['SESS_USER_ID']) {
         $data['editable'] = "true";
         $data['edit_url'] = _link("guides") . "/edit/" . md5($data['id']);
     } elseif (checkUserRoles("guides", "Allow Editing All Guides")) {
         $data['editable'] = "true";
         $data['edit_url'] = _link("guides") . "/edit/" . md5($data['id']);
     } else {
         $data['editable'] = "false";
     }
     if (checkUserRoles("guides", "Allow Editing All Guides")) {
         $data['viewable'] = true;
     } elseif ($data['status'] == "draft") {
         if ($data['authorid'] == $_SESSION['SESS_USER_ID'] || $data['creatorid'] == $_SESSION['SESS_USER_ID']) {
             $data['viewable'] = true;
         } else {
             $data['viewable'] = false;
         }
     } else {
         $data['viewable'] = true;
     }
     return $data;
 }
Beispiel #2
0
 function checkTitle($title)
 {
     $cols = " count(*) as titlecount";
     $whr = "blocked='false' AND title LIKE '" . $title . "'";
     $sql = _db()->_selectQ('api_toc', $cols, $whr);
     $res = _dbQuery($sql);
     $data = _dbFetch($res);
     return $data;
 }