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


PHP Groups::add方法代码示例

本文整理汇总了PHP中Groups::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Groups::add方法的具体用法?PHP Groups::add怎么用?PHP Groups::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Groups的用法示例。


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

示例1: AdminPage

<?php

require_once "config.php";
require_once WWW_DIR . "/lib/adminpage.php";
require_once WWW_DIR . "/lib/groups.php";
require_once WWW_DIR . "/lib/category.php";
$page = new AdminPage();
$groups = new Groups();
$category = new Category();
$id = 0;
// set the current action
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view';
switch ($action) {
    case 'submit':
        if ($_POST["id"] == "") {
            $groups->add($_POST);
        } else {
            $groups->update($_POST);
        }
        header("Location:" . WWW_TOP . "/group-list.php");
        break;
    case 'view':
    default:
        if (isset($_GET["id"])) {
            $page->title = "Newsgroup Edit";
            $id = $_GET["id"];
            $group = $groups->getByID($id);
        } else {
            $page->title = "Newsgroup Add";
            $group = array();
            $group["active"] = "1";
开发者ID:nubzzz,项目名称:newznab,代码行数:31,代码来源:group-edit.php

示例2: sprintf

                        $sqlrecentdiscard = sprintf("select GID from releases where name = %s and categoryID = %d and postdate between date_add(%s, INTERVAL -2 DAY) and date_add(%s, INTERVAL 1 DAY)", $db->escapeString($name), $catId, $db->escapeString(date("Y-m-d H:i:s", $nzbInfo->postedlast)), $db->escapeString(date("Y-m-d H:i:s", $nzbInfo->postedlast)));
                        $recentdiscrows = $db->query($sqlrecentdiscard);
                        if (count($recentdiscrows) > 0) {
                            if ($verbose) {
                                echo sprintf("Skipping Diff GID %s (%s) %s-%s\n", $name, $groupName, $nzbInfo->gid, $recentdiscrows[0]["GID"]);
                            }
                        } else {
                            // insert release
                            $relid = $r->insertRelease($name, $nzbInfo->filecount, $groupID, $relguid, $catId, "", date("Y-m-d H:i:s", $nzbInfo->postedlast), $nzbInfo->poster, "", $site);
                            $db->exec(sprintf("update releases set totalpart = %d, size = %s, completion = %d, GID=%s where ID = %d", $nzbInfo->filecount, $nzbInfo->filesize, $nzbInfo->completion, $db->escapeString($nzbInfo->gid), $relid));
                            // move to disk
                            $nzbfilename = $nzb->getNZBPath($relguid, $site->nzbpath, true);
                            $fp = _gzopen($nzbfilename, "w");
                            if ($fp) {
                                gzwrite($fp, $nzbInfo->toNzb());
                                gzclose($fp);
                                echo sprintf("Imported %s (%s)\n", $name, $groupName);
                            }
                        }
                    }
                }
            }
            // add missing groups
            if ($addmissinggroups) {
                foreach (array_unique($missinggroups) as $gr) {
                    $grp->add(array("name" => $gr, "description" => "Auto added", "active" => 1));
                }
            }
        }
    }
}
开发者ID:scriptzteam,项目名称:newzNZB-premium-indexer,代码行数:31,代码来源:gidimp.php

示例3: Groups

<?php

require '../../../init.php';
$error_name = $error_desc = false;
if (!isset($_GET['name']) or empty($_GET['name'])) {
    $error_name = true;
}
if (!isset($_GET['description']) or empty($_GET['description']) or strlen($_GET['description']) > 255) {
    $error_desc = true;
}
if (!$error_name && !$error_desc) {
    $Groups = new Groups(array('name' => $_GET['name'], 'desc' => $_GET['description']));
    echo $Groups->add();
}
?>
<div id="group-purchase-header">
   <img src="http://images.habbo.com/habboweb/63_1dc60c6d6ea6e089c6893ab4e0541ee0/1458/web-gallery/images/groups/group_icon.gif" alt="" width="46" height="46" />
</div>
<?php 
if ($error_name && $error_desc) {
    ?>
<form action="#" method="post" id="purchase-group-form-id">

<div id="group-name-area">
    <div id="group_name_message_error" class="error">
	    <?php 
    if ($error_name) {
        echo 'Nom de groupe indéfini.';
    }
    ?>
    </div>
开发者ID:habb0,项目名称:HabboPHP,代码行数:31,代码来源:index.php

示例4: scanNZBFile

 /**
  * @param object $nzbXML Reference of simpleXmlObject with NZB contents.
  * @param bool|string $useNzbName Use the NZB file name as release name?
  * @return bool
  *
  * @access protected
  */
 protected function scanNZBFile(&$nzbXML, $useNzbName = false)
 {
     $totalFiles = $totalSize = $groupID = 0;
     $isBlackListed = $groupName = $firstName = $posterName = $postDate = false;
     // Go through the NZB, get the details, look if it's blacklisted, look if we have the groups.
     foreach ($nzbXML->file as $file) {
         $totalFiles++;
         $groupID = -1;
         // Get the nzb info.
         if ($firstName === false) {
             $firstName = (string) $file->attributes()->subject;
         }
         if ($posterName === false) {
             $posterName = (string) $file->attributes()->poster;
         }
         if ($postDate === false) {
             $postDate = date("Y-m-d H:i:s", (string) $file->attributes()->date);
         }
         // Make a fake message array to use to check the blacklist.
         $msg = ["Subject" => (string) $file->attributes()->subject, "From" => (string) $file->attributes()->poster, "Message-ID" => ""];
         // Get the group names, group_id, check if it's blacklisted.
         $groupArr = [];
         foreach ($file->groups->group as $group) {
             $group = (string) $group;
             // If group_id is -1 try to get a group_id.
             if ($groupID === -1) {
                 if (array_key_exists($group, $this->allGroups)) {
                     $groupID = $this->allGroups[$group];
                     if (!$groupName) {
                         $groupName = $group;
                     }
                 } else {
                     $groupID = $this->groups->add(['name' => $group, 'description' => 'Added by NZBimport script.', 'backfill_target' => 0, 'first_record' => 0, 'last_record' => 0, 'active' => 0, 'backfill' => 0]);
                     $this->allGroups[$group] = $groupID;
                     $this->echoOut("Adding missing group: ({$group})");
                 }
             }
             // Add all the found groups to an array.
             $groupArr[] = $group;
             // Check if this NZB is blacklisted.
             if ($this->binaries->isBlacklisted($msg, $group)) {
                 $isBlackListed = true;
                 break;
             }
         }
         // If we found a group and it's not blacklisted.
         if ($groupID !== -1 && !$isBlackListed) {
             // Get the size of the release.
             if (count($file->segments->segment) > 0) {
                 foreach ($file->segments->segment as $segment) {
                     $totalSize += (int) $segment->attributes()->bytes;
                 }
             }
         } else {
             if ($isBlackListed) {
                 $errorMessage = "Subject is blacklisted: " . utf8_encode(trim($firstName));
             } else {
                 $errorMessage = "No group found for " . $firstName . " (one of " . implode(', ', $groupArr) . " are missing";
             }
             $this->echoOut($errorMessage);
             return false;
         }
     }
     // Try to insert the NZB details into the DB.
     return $this->insertNZB(['subject' => $firstName, 'useFName' => $useNzbName, 'postDate' => empty($postDate) ? date("Y-m-d H:i:s") : $postDate, 'from' => empty($posterName) ? '' : $posterName, 'groupid' => $groupID, 'groupName' => $groupName, 'totalFiles' => $totalFiles, 'totalSize' => $totalSize]);
 }
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:73,代码来源:NZBImport.php


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