当前位置: 首页>>代码示例>>PHP>>正文


PHP query_full_array函数代码示例

本文整理汇总了PHP中query_full_array函数的典型用法代码示例。如果您正苦于以下问题:PHP query_full_array函数的具体用法?PHP query_full_array怎么用?PHP query_full_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了query_full_array函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: copy

 /**
  * duplicates an article
  * @param string $newtitle the title for the new article
  */
 function copy($newtitle)
 {
     $newID = $newtitle;
     $id = parent::copy(array('titlelink' => $newID));
     if (!$id) {
         $newID = $newtitle . ':' . seoFriendly(date('Y-m-d_H-i-s'));
         $id = parent::copy(array('titlelink' => $newID));
     }
     if ($id) {
         $newobj = new ZenpageNews($newID);
         $newobj->setTitle($newtitle);
         $newobj->setTags($this->getTags());
         $newobj->save();
         $categories = array();
         foreach ($this->getCategories() as $cat) {
             $categories[] = $cat['cat_id'];
         }
         $result = query_full_array("SELECT * FROM " . prefix('news_categories') . " ORDER BY titlelink");
         foreach ($result as $cat) {
             if (in_array($cat['id'], $categories)) {
                 query("INSERT INTO " . prefix('news2cat') . " (cat_id, news_id) VALUES ('" . $cat['id'] . "', '" . $id . "')");
             }
         }
         return $newobj;
     }
     return false;
 }
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:31,代码来源:zenpage-class-news.php

示例2: handleOption

 function handleOption($option, $currentValue)
 {
     if ($option == "zenpage_homepage") {
         $unpublishedpages = query_full_array("SELECT titlelink FROM " . prefix('pages') . " WHERE `show` != 1 ORDER by `sort_order`");
         if (empty($unpublishedpages)) {
             echo gettext("No unpublished pages available");
             // clear option if no unpublished pages are available or have been published meanwhile
             // so that the normal gallery index appears and no page is accidentally set if set to unpublished again.
             setOption("zenpage_homepage", "none", true);
         } else {
             echo '<input type="hidden" name="' . CUSTOM_OPTION_PREFIX . 'selector-zenpage_homepage" value="0" />' . "\n";
             echo '<select id="' . $option . '" name="zenpage_homepage">' . "\n";
             if ($currentValue === "none") {
                 $selected = " selected = 'selected'";
             } else {
                 $selected = "";
             }
             echo "<option{$selected}>" . gettext("none") . "</option>";
             foreach ($unpublishedpages as $page) {
                 if ($currentValue === $page["titlelink"]) {
                     $selected = " selected = 'selected'";
                 } else {
                     $selected = "";
                 }
                 echo "<option{$selected}>" . $page["titlelink"] . "</option>";
             }
             echo "</select>\n";
         }
     }
 }
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:30,代码来源:themeoptions.php

示例3: getOptionsSupported

 function getOptionsSupported()
 {
     $unpublishedpages = query_full_array("SELECT title,titlelink FROM " . prefix('pages') . " WHERE `show` != 1 ORDER by `sort_order`");
     $list = array();
     foreach ($unpublishedpages as $page) {
         $list[get_language_string($page['title'])] = $page['titlelink'];
     }
     return array(gettext('Allow search') => array('key' => 'Allow_search', 'type' => OPTION_TYPE_CHECKBOX, 'desc' => gettext('Check to enable search form.')), gettext('News on index page') => array('key' => 'zenpage_zp_index_news', 'type' => OPTION_TYPE_CHECKBOX, 'desc' => gettext("Enable this if you want to show the news section’s first page on the <code>index.php</code> page.")), gettext('Homepage') => array('key' => 'zenpage_homepage', 'type' => OPTION_TYPE_SELECTOR, 'selections' => $list, 'null_selection' => gettext('none'), 'desc' => gettext("Choose here any <em>un-published Zenpage page</em> (listed by <em>titlelink</em>) to act as your site’s homepage instead the normal gallery index.") . "<p class='notebox'>" . gettext("<strong>Note:</strong> This of course overrides the <em>News on index page</em> option and your theme must be setup for this feature! Visit the theming tutorial for details.") . "</p>"), gettext('Use standard contact page') => array('key' => 'zenpage_contactpage', 'type' => OPTION_TYPE_CHECKBOX, 'desc' => gettext('Disable this if you do not want to use the separate contact page with the contact form. You can also use the codeblock of a page for this. See the contact_form plugin documentation for more info.')), gettext('Use custom menu') => array('key' => 'zenpage_custommenu', 'type' => OPTION_TYPE_CHECKBOX, 'desc' => gettext('Check this if you want to use the <em>menu_manager</em> plugin if enabled to build a custom menu instead of the separate standard ones. A standard menu named "zenpage" is created and used automatically.')));
 }
开发者ID:bgenere,项目名称:negpos,代码行数:9,代码来源:themeoptions.php

示例4: getLatestImages

 static function getLatestImages($limit = 3)
 {
     if (!isset($limit) || !is_numeric($limit)) {
         $limit = 3;
     }
     $t_images = prefix("images");
     $t_albums = prefix("albums");
     $query = "SELECT i.filename, i.title, a.folder FROM {$t_images} i " . "LEFT JOIN {$t_albums} a ON i.albumid=a.id " . "ORDER BY i.id DESC LIMIT {$limit}";
     $result = query_full_array($query);
     return self::createImages($result);
 }
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:11,代码来源:Utils.php

示例5: handleOption

 function handleOption($option, $currentValue)
 {
     switch ($option) {
         case 'garland_menu':
             $menusets = array();
             echo '<select id="garland_menuset" name="garland_menu"';
             if (function_exists('printCustomMenu') && getThemeOption('custom_index_page', NULL, 'garland') === 'gallery') {
                 $result = query_full_array("SELECT DISTINCT menuset FROM " . prefix('menu') . " ORDER BY menuset");
                 foreach ($result as $set) {
                     $menusets[$set['menuset']] = $set['menuset'];
                 }
             } else {
                 echo ' disabled="disabled"';
             }
             echo ">\n";
             echo '<option value="" style="background-color:LightGray">' . gettext('*standard menu') . '</option>';
             generateListFromArray(array($currentValue), $menusets, false, false);
             echo "</select>\n";
             break;
     }
 }
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:21,代码来源:themeoptions.php

示例6: getAlbumStatistic

/**
 * Retuns a list of album statistic accordingly to $option
 *
 * @param int $number the number of albums to get
 * @param string $option "popular" for the most popular albums,
 *     "latest" for the latest uploaded, "mostrated" for the most voted,
 *     "toprated" for the best voted
 * 		 "latestupdated" for the latest updated
 *	@param string $albumfolder The name of an album to get only the statistc for its subalbums
 * @return string
 */
function getAlbumStatistic($number = 5, $option, $albumfolder = '')
{
    global $_zp_gallery;
    if (!isset($_zp_gallery)) {
        // needed for gallery stats as $_zp_gallery is not set...
        $_zp_gallery = new Gallery();
    }
    $albumlist = array();
    if ($albumfolder) {
        $obj = new Album($_zp_gallery, $albumfolder);
        $albumlist[] = $obj->getID();
    } else {
        $obj = $_zp_gallery;
    }
    getImageAlbumAlbumList($obj, $albumlist);
    $albumWhere = '';
    if (!empty($albumlist)) {
        $albumWhere = ' WHERE (`id`=' . implode(' OR `id`=', $albumlist) . ')';
    }
    switch ($option) {
        case "popular":
            $sortorder = "hitcounter";
            break;
        case "latest":
            $sortorder = "id";
            break;
        case "mostrated":
            $sortorder = "total_votes";
            break;
        case "toprated":
            $sortorder = "(total_value/total_votes)";
            break;
        case "latestupdated":
            $sortorder = 'updateddate';
            break;
    }
    $albums = query_full_array("SELECT id, title, folder, thumb FROM " . prefix('albums') . $albumWhere . " ORDER BY " . $sortorder . " DESC LIMIT " . $number);
    return $albums;
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:50,代码来源:image_album_statistics.php

示例7: getRandomImages

 static function getRandomImages($limit = 3, $albums = NULL)
 {
     if ($limit == 0) {
         $limit = 1;
     }
     $t_images = prefix("images");
     $t_albums = prefix("albums");
     $idQuery = "select img.id from {$t_images} img";
     $where = "";
     if (!is_null($albums) && count($albums) > 0) {
         $all = '';
         for ($u = 0; $u < count($albums); $u++) {
             if ($u > 0) {
                 $all .= ", ";
             }
             $all .= "'" . $albums[$u] . "'";
         }
         $where = " LEFT JOIN {$t_albums} album ON img.albumid=album.id " . "WHERE album.folder IN ({$all}) ORDER BY img.id";
     }
     $idQuery .= $where;
     $result = query_full_array($idQuery);
     $rowCount = count($result);
     $u = 0;
     $ids = "";
     while ($u < $limit) {
         $id = rand(0, $rowCount - 1);
         if ($u > 0) {
             $ids .= ", ";
         }
         $ids .= $result[$id]['id'];
         $u++;
     }
     $query = "SELECT i.filename, i.title, a.folder FROM {$t_images} i " . "LEFT JOIN {$t_albums} a ON i.albumid=a.id WHERE i.id IN ({$ids})";
     $result = query_full_array($query);
     return self::createImages($result);
 }
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:36,代码来源:AlbumUtil.php

示例8: unset

 $action = $_POST['tag_action'];
 unset($_POST['tag_action']);
 if (isset($_POST['tag_list_tags_'])) {
     $tags = sanitize($_POST['tag_list_tags_']);
 } else {
     $tags = array();
 }
 switch ($action) {
     case 'delete':
         if (count($tags) > 0) {
             $sql = "SELECT `id` FROM " . prefix('tags') . " WHERE ";
             foreach ($tags as $tag) {
                 $sql .= "`name`=" . db_quote($tag) . " OR ";
             }
             $sql = substr($sql, 0, strlen($sql) - 4);
             $dbtags = query_full_array($sql);
             if (is_array($dbtags) && count($dbtags) > 0) {
                 $sqltags = "DELETE FROM " . prefix('tags') . " WHERE ";
                 $sqlobjects = "DELETE FROM " . prefix('obj_to_tag') . " WHERE ";
                 foreach ($dbtags as $tag) {
                     $sqltags .= "`id`='" . $tag['id'] . "' OR ";
                     $sqlobjects .= "`tagid`='" . $tag['id'] . "' OR ";
                 }
                 $sqltags = substr($sqltags, 0, strlen($sqltags) - 4);
                 query($sqltags);
                 $sqlobjects = substr($sqlobjects, 0, strlen($sqlobjects) - 4);
                 query($sqlobjects);
             }
         }
         $action = gettext('Checked tags deleted');
         break;
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:31,代码来源:admin-tags.php

示例9: handleOption


//.........这里部分代码省略.........
            }
            echo "</select>\n";
        }
        if ($option == 'zpfocus_final_link') {
            echo '<select style="width:200px;
						" id="' . $option . '" name="' . $option . '"' . ">\n";
            echo '<option value="colorbox"';
            if ($currentValue == "colorbox") {
                echo ' selected="selected">colorbox</option>\\n';
            } else {
                echo '>colorbox</option>\\n';
            }
            echo '<option value="nolink"';
            if ($currentValue == "nolink") {
                echo ' selected="selected">nolink</option>\\n';
            } else {
                echo '>nolink</option>\\n';
            }
            echo '<option value="standard"';
            if ($currentValue == "standard") {
                echo ' selected="selected">standard</option>\\n';
            } else {
                echo '>standard</option>\\n';
            }
            echo '<option value="standard-new"';
            if ($currentValue == "standard-new") {
                echo ' selected="selected">standard-new</option>\\n';
            } else {
                echo '>standard-new</option>\\n';
            }
            echo "</select>\n";
        }
        if ($option == 'zpfocus_menutype') {
            echo '<select style="width:100px;
						" id="' . $option . '" name="' . $option . '"' . ">\n";
            echo '<option value="dropdown"';
            if ($currentValue == "dropdown") {
                echo ' selected="selected">DropDown</option>\\n';
            } else {
                echo '>DropDown</option>\\n';
            }
            echo '<option value="jump"';
            if ($currentValue == 'jump') {
                echo ' selected="selected">Jump</option>\\n';
            } else {
                echo '>Jump</option>\\n';
            }
            echo "</select>\n";
        }
        if ($option == 'zpfocus_spotlight') {
            echo '<select style="width:100px;
						" id="' . $option . '" name="' . $option . '"' . ">\n";
            echo '<option value="none"';
            if ($currentValue == "none") {
                echo ' selected="selected">None</option>\\n';
            } else {
                echo '>None</option>\\n';
            }
            echo '<option value="manual"';
            if ($currentValue == 'manual') {
                echo ' selected="selected">Manual</option>\\n';
            } else {
                echo '>Manual</option>\\n';
            }
            echo '<option value="latest"';
            if ($currentValue == 'latest') {
                echo ' selected="selected">Latest News</option>\\n';
            } else {
                echo '>Latest News</option>\\n';
            }
            echo "</select>\n";
        }
        if ($option == "zpfocus_homepage") {
            $unpublishedpages = query_full_array("SELECT titlelink FROM " . prefix('pages') . " WHERE `show` != 1 ORDER by `sort_order`");
            if (empty($unpublishedpages)) {
                echo gettext("No unpublished pages available");
                // clear option if no unpublished pages are available or have been published meanwhile
                // so that the normal gallery index appears and no page is accidentally set if set to unpublished again.
                setOption("zpfocus_homepage", "none");
            } else {
                echo '<input type="hidden" name="' . CUSTOM_OPTION_PREFIX . 'selector-zpfocus_homepage" value="0" />' . "\n";
                echo '<select id="' . $option . '" name="zpfocus_homepage">' . "\n";
                if ($currentValue === "none") {
                    $selected = " selected = 'selected'";
                } else {
                    $selected = "";
                }
                echo "<option{$selected}>" . gettext("none") . "</option>";
                foreach ($unpublishedpages as $page) {
                    if ($currentValue === $page["titlelink"]) {
                        $selected = "  selected =    'selected'";
                    } else {
                        $selected = "";
                    }
                    echo "<option{$selected}>" . $page["titlelink"] . "</option>";
                }
                echo "</select>\n";
            }
        }
    }
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:101,代码来源:themeoptions.php

示例10: searchFieldsAndTags

 /**
  * Searches the table for tags
  * Returns an array of database records.
  *
  * @param string $searchstring
  * @param string $tbl set to 'albums' or 'images'
  * @param string $sorttype what to sort on
  * @param string $sortdirection what direction
  * @return array
  */
 function searchFieldsAndTags($searchstring, $tbl, $sorttype, $sortdirection)
 {
     $allIDs = null;
     $idlist = array();
     $exact = EXACT_TAG_MATCH;
     // create an array of [tag, objectid] pairs for tags
     $tag_objects = array();
     $fields = $this->fieldList;
     if (count($fields) == 0) {
         // then use the default ones
         $fields = $this->allowedSearchFields();
     }
     foreach ($fields as $key => $field) {
         if (strtolower($field) == 'tags') {
             unset($fields[$key]);
             $tagsql = 'SELECT t.`name`, o.`objectid` FROM ' . prefix('tags') . ' AS t, ' . prefix('obj_to_tag') . ' AS o WHERE t.`id`=o.`tagid` AND o.`type`="' . $tbl . '" AND (';
             foreach ($searchstring as $singlesearchstring) {
                 switch ($singlesearchstring) {
                     case '&':
                     case '!':
                     case '|':
                     case '(':
                     case ')':
                         break;
                     default:
                         $targetfound = true;
                         if ($exact) {
                             $tagsql .= '`name` = ' . db_quote($singlesearchstring) . ' OR ';
                         } else {
                             $tagsql .= '`name` LIKE ' . db_quote('%' . $singlesearchstring . '%') . ' OR ';
                         }
                 }
             }
             $tagsql = substr($tagsql, 0, strlen($tagsql) - 4) . ') ORDER BY t.`id`';
             $objects = query_full_array($tagsql, false);
             if (is_array($objects)) {
                 $tag_objects = $objects;
             }
             break;
         }
     }
     // create an array of [name, objectid] pairs for the search fields.
     $field_objects = array();
     if (count($fields) > 0) {
         $columns = array();
         $dbfields = db_list_fields($tbl);
         if (is_array($dbfields)) {
             foreach ($dbfields as $row) {
                 $columns[] = strtolower($row['Field']);
             }
         }
         foreach ($searchstring as $singlesearchstring) {
             switch ($singlesearchstring) {
                 case '&':
                 case '!':
                 case '|':
                 case '(':
                 case ')':
                     break;
                 default:
                     $targetfound = true;
                     query('SET @serachtarget=' . db_quote($singlesearchstring));
                     $fieldsql = '';
                     foreach ($fields as $fieldname) {
                         if ($tbl == 'albums' && $fieldname == 'filename') {
                             $fieldname = 'folder';
                         } else {
                             $fieldname = strtolower($fieldname);
                         }
                         if ($fieldname && in_array($fieldname, $columns)) {
                             $fieldsql .= ' `' . $fieldname . '` LIKE ' . db_quote('%' . $singlesearchstring . '%') . ' OR ';
                         }
                     }
                     if (!empty($fieldsql)) {
                         $fieldsql = substr($fieldsql, 0, strlen($fieldsql) - 4) . ') ORDER BY `id`';
                         $sql = 'SELECT @serachtarget AS name, `id` AS `objectid` FROM ' . prefix($tbl) . ' WHERE (' . $fieldsql;
                         $objects = query_full_array($sql, false);
                         if (is_array($objects)) {
                             $field_objects = array_merge($field_objects, $objects);
                         }
                     }
             }
         }
     }
     $objects = array_merge($tag_objects, $field_objects);
     if (count($objects) != 0) {
         $tagid = '';
         $taglist = array();
         foreach ($objects as $object) {
             $tagid = strtolower($object['name']);
//.........这里部分代码省略.........
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:101,代码来源:class-search.php

示例11: setupLog

     setupLog(sprintf(gettext("Previous Release was %s"), $prevRel), true);
 }
 require dirname(__FILE__) . '/setup-option-defaults.php';
 if ($debug == 'base64') {
     // update zenpage codeblocks--remove the base64 encoding
     $sql = 'SELECT `id`, `codeblock` FROM ' . prefix('news') . ' WHERE `codeblock` NOT REGEXP "^a:[0-9]+:{"';
     $result = query_full_array($sql, false);
     if (is_array($result)) {
         foreach ($result as $row) {
             $codeblock = base64_decode($row['codeblock']);
             $sql = 'UPDATE ' . prefix('news') . ' SET `codeblock`=' . db_quote($codeblock) . ' WHERE `id`=' . $row['id'];
             query($sql);
         }
     }
     $sql = 'SELECT `id`, `codeblock` FROM ' . prefix('pages') . ' WHERE `codeblock` NOT REGEXP "^a:[0-9]+:{"';
     $result = query_full_array($sql, false);
     if (is_array($result)) {
         foreach ($result as $row) {
             $codeblock = base64_decode($row['codeblock']);
             $sql = 'UPDATE ' . prefix('pages') . ' SET `codeblock`=' . db_quote($codeblock) . ' WHERE `id`=' . $row['id'];
             query($sql);
         }
     }
 }
 if ($debug == 'albumids') {
     // fixes 1.2 move/copy albums with wrong ids
     $albums = $_zp_gallery->getAlbums();
     foreach ($albums as $album) {
         checkAlbumParentid($album, NULL, 'setuplog');
     }
 }
开发者ID:rauldobrota,项目名称:zenphoto,代码行数:31,代码来源:index.php

示例12: query_full_array

$result = query_full_array($sql);
if (is_array($result)) {
    foreach ($result as $row) {
        $filename = $row['creator'];
        if (!file_exists(SERVERPATH . '/' . $filename)) {
            $sql = 'DELETE FROM ' . prefix('options') . ' WHERE `creator`=' . db_quote($filename);
            query($sql);
            if (strpos($filename, PLUGIN_FOLDER) !== false || strpos($filename, USER_PLUGIN_FOLDER) !== false) {
                purgeOption('zp_plugin_' . stripSuffix(basename($filename)));
            }
        }
    }
}
// missing themes
$sql = 'SELECT DISTINCT `theme` FROM ' . prefix('options') . ' WHERE `theme` IS NOT NULL';
$result = query_full_array($sql);
if (is_array($result)) {
    foreach ($result as $row) {
        $filename = THEMEFOLDER . '/' . $row['theme'];
        if ($filename && !file_exists(SERVERPATH . '/' . $filename)) {
            $sql = 'DELETE FROM ' . prefix('options') . ' WHERE `theme`=' . db_quote($row['theme']);
            query($sql);
        }
    }
}
setOptionDefault('search_cache_duration', 30);
setOptionDefault('search_within', 1);
setOption('last_update_check', 30);
$autoRotate = getOption('auto_rotate');
if (!is_null($autoRotate)) {
    if (!$autoRotate) {
开发者ID:rb26,项目名称:zenphoto,代码行数:31,代码来源:setup-option-defaults.php

示例13: remove

 /**
  * Deletes a page (and also if existing its subpages) from the database
  *
  */
 function remove()
 {
     if ($success = parent::remove()) {
         $sortorder = $this->getSortOrder();
         if ($this->id) {
             $success = $success && query("DELETE FROM " . prefix('obj_to_tag') . "WHERE `type`='pages' AND `objectid`=" . $this->id);
             $success = $success && query("DELETE FROM " . prefix('comments') . " WHERE ownerid = " . $this->getID() . ' AND type="pages"');
             // delete any comments
             //	remove subpages
             $mychild = strlen($sortorder) + 4;
             $result = query_full_array('SELECT * FROM ' . prefix('pages') . " WHERE `sort_order` like '" . $sortorder . "-%'");
             if (is_array($result)) {
                 foreach ($result as $row) {
                     if (strlen($row['sort_order']) == $mychild) {
                         $subpage = new ZenpagePage($row['titlelink']);
                         $success = $success && $subpage->remove();
                     }
                 }
             }
         }
     }
     return $success;
 }
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:27,代码来源:zenpage-class-page.php

示例14: getLatestZenpageComments

/**
 * Gets latest comments for news articles and pages
 *
 * @param int $number how many comments you want.
 * @param string $type 	"all" for all latest comments for all news articles and all pages
 * 											"news" for the lastest comments of one specific news article
 * 											"page" for the lastest comments of one specific page
 * @param int $itemID the ID of the element to get the comments for if $type != "all"
 */
function getLatestZenpageComments($number, $type = "all", $itemID = "")
{
    $itemID = sanitize_numeric($itemID);
    $number = sanitize_numeric($number);
    $checkauth = zp_loggedin();
    if ($type == 'all' || $type == 'news') {
        $newspasswordcheck = "";
        if (zp_loggedin(MANAGE_ALL_NEWS_RIGHTS)) {
            $newsshow = '';
        } else {
            $newsshow = 'news.show=1 AND';
            $newscheck = query_full_array("SELECT * FROM " . prefix('news') . " ORDER BY date");
            foreach ($newscheck as $articlecheck) {
                $obj = new ZenpageNews($articlecheck['titlelink']);
                if ($obj->inProtectedCategory()) {
                    if ($checkauth && $obj->isMyItem(LIST_RIGHTS)) {
                        $newsshow = '';
                    } else {
                        $excludenews = " AND id != " . $articlecheck['id'];
                        $newspasswordcheck = $newspasswordcheck . $excludenews;
                    }
                }
            }
        }
    }
    if ($type == 'all' || $type == 'page') {
        $pagepasswordcheck = "";
        if (zp_loggedin(MANAGE_ALL_PAGES_RIGHTS)) {
            $pagesshow = '';
        } else {
            $pagesshow = 'pages.show=1 AND';
            $pagescheck = query_full_array("SELECT * FROM " . prefix('pages') . " ORDER BY date");
            foreach ($pagescheck as $pagecheck) {
                $obj = new ZenpagePage($pagecheck['titlelink']);
                if ($obj->isProtected()) {
                    if ($checkauth && $obj->isMyItem(LIST_RIGHTS)) {
                        $pagesshow = '';
                    } else {
                        $excludepages = " AND pages.id != " . $pagecheck['id'];
                        $pagepasswordcheck = $pagepasswordcheck . $excludepages;
                    }
                }
            }
        }
    }
    switch ($type) {
        case "news":
            $whereNews = " WHERE {$newsshow} news.id = " . $itemID . " AND c.ownerid = news.id AND c.type = 'news' AND c.private = 0 AND c.inmoderation = 0" . $newspasswordcheck;
            break;
        case "page":
            $wherePages = " WHERE {$pagesshow} pages.id = " . $itemID . " AND c.ownerid = pages.id AND c.type = 'pages' AND c.private = 0 AND c.inmoderation = 0" . $pagepasswordcheck;
            break;
        case "all":
            $whereNews = " WHERE {$newsshow} c.ownerid = news.id AND c.type = 'news' AND c.private = 0 AND c.inmoderation = 0" . $newspasswordcheck;
            $wherePages = " WHERE {$pagesshow} c.ownerid = pages.id AND c.type = 'pages' AND c.private = 0 AND c.inmoderation = 0" . $pagepasswordcheck;
            break;
    }
    $comments_news = array();
    $comments_pages = array();
    if ($type == "all" or $type == "news") {
        $comments_news = query_full_array("SELECT c.id, c.name, c.type, c.website," . " c.date, c.anon, c.comment, news.title, news.titlelink FROM " . prefix('comments') . " AS c, " . prefix('news') . " AS news " . $whereNews . " ORDER BY c.id DESC LIMIT {$number}");
    }
    if ($type == "all" or $type == "page") {
        $comments_pages = query_full_array($sql = "SELECT c.id, c.name, c.type, c.website," . " c.date, c.anon, c.comment, pages.title, pages.titlelink FROM " . prefix('comments') . " AS c, " . prefix('pages') . " AS pages " . $wherePages . " ORDER BY c.id DESC LIMIT {$number}");
    }
    $comments = array();
    foreach ($comments_news as $comment) {
        $comments[$comment['id']] = $comment;
    }
    foreach ($comments_pages as $comment) {
        $comments[$comment['id']] = $comment;
    }
    krsort($comments);
    return array_slice($comments, 0, $number);
}
开发者ID:rauldobrota,项目名称:zenphoto,代码行数:84,代码来源:zenpage-template-functions.php

示例15: addCategoriesToDatabase

/**
 * Adds Zenpage news categories to the menu set
 * @param string $menuset chosen menu set
 */
function addCategoriesToDatabase($menuset, $base = NULL)
{
    if (is_null($base)) {
        $categorybase = db_count('menu', 'WHERE menuset=' . db_quote($menuset));
        $sortbase = '';
    } else {
        $categorybase = array_pop($base);
        $sortbase = '';
        for ($i = 0; $i < count($base); $i++) {
            $sortbase .= sprintf('%03u', $base[$i]) . '-';
        }
    }
    $result = $categorybase;
    $parents = array('NULL');
    $result = query_full_array("SELECT * FROM " . prefix('news_categories') . " ORDER BY sort_order");
    foreach ($result as $key => $item) {
        $sorts = explode('-', $item['sort_order']);
        $level = count($sorts);
        $sorts[0] = sprintf('%03u', $result = $sorts[0] + $categorybase);
        $order = $sortbase . implode('-', $sorts);
        $link = $item['titlelink'];
        $parent = $parents[$level - 1];
        $sql = "INSERT INTO " . prefix('menu') . " (`title`, `link`, `type`, `show`,`menuset`,`sort_order`,`parentid`) " . 'VALUES (' . db_quote($item['title']) . ',' . db_quote($link) . ',"zenpagecategory", 1,' . db_quote($menuset) . ',' . db_quote($order) . ',' . $parent . ')';
        if (query($sql, false)) {
            $id = db_insert_id();
        } else {
            $rslt = query_single_row('SELECT `id` FROM' . prefix('menu') . ' WHERE `type`="zenpagecategory" AND `link`="' . $link . '"');
            $id = $rslt['id'];
        }
        $parents[$level] = $id;
    }
    return $result;
}
开发者ID:JoniWeiss,项目名称:JoniWebGirl,代码行数:37,代码来源:menu_manager-admin-functions.php


注:本文中的query_full_array函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。