コード例 #1
0
 /**
  * repository::_gen_repid
  *
  * generate new repository Id´s
  *
  */
 function _gen_repid($name, $type = 'mod', $force = false)
 {
     global $cms_db;
     $hash = lib_hash_name($name, $type);
     $key = lib_make_key();
     $sql = "SELECT * FROM " . $cms_db[$type] . " WHERE repository_id like '" . $hash . "%' AND source_id = 0";
     $result = $this->_fetch_query($sql);
     if ($result && !$force) {
         return $this->_set_error('1', '1507');
     } else {
         return $hash . ':' . $key;
     }
 }
コード例 #2
0
ファイル: fnc.libary.php プロジェクト: rbraband/sefrengo
function lib_build_repository_ids($order = 'mod', $idclient = '')
{
    global $db, $cfg_cms, $cms_db;
    $dbupdate = $db = new DB_cms();
    $ident = $idclient == '' ? '' : "idclient = '{$idclient}' AND";
    $sql = "SELECT name, id{$order} FROM " . $cms_db["{$order}"] . " WHERE {$ident} repository_id IS NULL";
    $db->query($sql);
    while ($db->next_record()) {
        $update = "UPDATE " . $cms_db["{$order}"] . " SET repository_id = '" . lib_hash_name($db->f('name'), $order) . ':' . lib_make_key() . "' WHERE id{$order} = '" . $db->f('id' . $order) . "'";
        $dbupdate->query($update);
    }
}